2 Produce "tftp" shell dynamic command.
4 Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved. <BR>
5 Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Protocol/ShellDynamicCommand.h>
14 This is the shell command handler function pointer callback type. This
15 function handles the command when it is invoked in the shell.
17 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
18 @param[in] SystemTable The pointer to the system table.
19 @param[in] ShellParameters The parameters associated with the command.
20 @param[in] Shell The instance of the shell protocol used in the context
21 of processing this command.
23 @return EFI_SUCCESS the operation was successful
24 @return other the operation failed.
29 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
30 IN EFI_SYSTEM_TABLE
*SystemTable
,
31 IN EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
32 IN EFI_SHELL_PROTOCOL
*Shell
35 gEfiShellParametersProtocol
= ShellParameters
;
36 gEfiShellProtocol
= Shell
;
37 return RunTftp (gImageHandle
, SystemTable
);
41 This is the command help handler function pointer callback type. This
42 function is responsible for displaying help information for the associated
45 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
46 @param[in] Language The pointer to the language string to use.
48 @return string Pool allocated help string, must be freed by caller
53 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
54 IN CONST CHAR8
*Language
57 return HiiGetString (mTftpHiiHandle
, STRING_TOKEN (STR_GET_HELP_TFTP
), Language
);
60 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand
= {
67 Entry point of Tftp Dynamic Command.
69 Produce the DynamicCommand protocol to handle "tftp" command.
71 @param ImageHandle The image handle of the process.
72 @param SystemTable The EFI System Table pointer.
74 @retval EFI_SUCCESS Tftp command is executed successfully.
75 @retval EFI_ABORTED HII package was failed to initialize.
76 @retval others Other errors when executing tftp command.
80 TftpCommandInitialize (
81 IN EFI_HANDLE ImageHandle
,
82 IN EFI_SYSTEM_TABLE
*SystemTable
86 mTftpHiiHandle
= InitializeHiiPackage (ImageHandle
);
87 if (mTftpHiiHandle
== NULL
) {
91 Status
= gBS
->InstallProtocolInterface (
93 &gEfiShellDynamicCommandProtocolGuid
,
97 ASSERT_EFI_ERROR (Status
);
102 Tftp driver unload handler.
104 @param ImageHandle The image handle of the process.
106 @retval EFI_SUCCESS The image is unloaded.
107 @retval Others Failed to unload the image.
112 IN EFI_HANDLE ImageHandle
116 Status
= gBS
->UninstallProtocolInterface (
118 &gEfiShellDynamicCommandProtocolGuid
,
121 if (EFI_ERROR (Status
)) {
124 HiiRemovePackages (mTftpHiiHandle
);