VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c@ 105598

最後變更 在這個檔案從105598是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 3.7 KB
 
1/** @file
2 Produce "tftp" shell dynamic command.
3
4 Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved. <BR>
5 Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9**/
10#include "Tftp.h"
11#include <Protocol/ShellDynamicCommand.h>
12
13/**
14 This is the shell command handler function pointer callback type. This
15 function handles the command when it is invoked in the shell.
16
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.
22
23 @return EFI_SUCCESS the operation was successful
24 @return other the operation failed.
25**/
26SHELL_STATUS
27EFIAPI
28TftpCommandHandler (
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
33 )
34{
35 gEfiShellParametersProtocol = ShellParameters;
36 gEfiShellProtocol = Shell;
37 return RunTftp (gImageHandle, SystemTable);
38}
39
40/**
41 This is the command help handler function pointer callback type. This
42 function is responsible for displaying help information for the associated
43 command.
44
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.
47
48 @return string Pool allocated help string, must be freed by caller
49**/
50CHAR16 *
51EFIAPI
52TftpCommandGetHelp (
53 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
54 IN CONST CHAR8 *Language
55 )
56{
57 return HiiGetString (mTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP), Language);
58}
59
60EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand = {
61 L"tftp",
62 TftpCommandHandler,
63 TftpCommandGetHelp
64};
65
66/**
67 Entry point of Tftp Dynamic Command.
68
69 Produce the DynamicCommand protocol to handle "tftp" command.
70
71 @param ImageHandle The image handle of the process.
72 @param SystemTable The EFI System Table pointer.
73
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.
77**/
78EFI_STATUS
79EFIAPI
80TftpCommandInitialize (
81 IN EFI_HANDLE ImageHandle,
82 IN EFI_SYSTEM_TABLE *SystemTable
83 )
84{
85 EFI_STATUS Status;
86
87 mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
88 if (mTftpHiiHandle == NULL) {
89 return EFI_ABORTED;
90 }
91
92 Status = gBS->InstallProtocolInterface (
93 &ImageHandle,
94 &gEfiShellDynamicCommandProtocolGuid,
95 EFI_NATIVE_INTERFACE,
96 &mTftpDynamicCommand
97 );
98 ASSERT_EFI_ERROR (Status);
99 return Status;
100}
101
102/**
103 Tftp driver unload handler.
104
105 @param ImageHandle The image handle of the process.
106
107 @retval EFI_SUCCESS The image is unloaded.
108 @retval Others Failed to unload the image.
109**/
110EFI_STATUS
111EFIAPI
112TftpUnload (
113 IN EFI_HANDLE ImageHandle
114 )
115{
116 EFI_STATUS Status;
117
118 Status = gBS->UninstallProtocolInterface (
119 ImageHandle,
120 &gEfiShellDynamicCommandProtocolGuid,
121 &mTftpDynamicCommand
122 );
123 if (EFI_ERROR (Status)) {
124 return Status;
125 }
126
127 HiiRemovePackages (mTftpHiiHandle);
128 return EFI_SUCCESS;
129}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette