VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c@ 77662

最後變更 在這個檔案從77662是 77662,由 vboxsync 提交於 6 年 前

EFI: First step in UDK2018 merge. Does not build yet.

  • 屬性 svn:eol-style 設為 native
檔案大小: 4.1 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 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15**/
16#include "Tftp.h"
17#include <Protocol/ShellDynamicCommand.h>
18
19/**
20 This is the shell command handler function pointer callback type. This
21 function handles the command when it is invoked in the shell.
22
23 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
24 @param[in] SystemTable The pointer to the system table.
25 @param[in] ShellParameters The parameters associated with the command.
26 @param[in] Shell The instance of the shell protocol used in the context
27 of processing this command.
28
29 @return EFI_SUCCESS the operation was sucessful
30 @return other the operation failed.
31**/
32SHELL_STATUS
33EFIAPI
34TftpCommandHandler (
35 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
36 IN EFI_SYSTEM_TABLE *SystemTable,
37 IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
38 IN EFI_SHELL_PROTOCOL *Shell
39 )
40{
41 gEfiShellParametersProtocol = ShellParameters;
42 gEfiShellProtocol = Shell;
43 return RunTftp (gImageHandle, SystemTable);
44}
45
46/**
47 This is the command help handler function pointer callback type. This
48 function is responsible for displaying help information for the associated
49 command.
50
51 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
52 @param[in] Language The pointer to the language string to use.
53
54 @return string Pool allocated help string, must be freed by caller
55**/
56CHAR16 *
57EFIAPI
58TftpCommandGetHelp (
59 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
60 IN CONST CHAR8 *Language
61 )
62{
63 return HiiGetString (mTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP), Language);
64}
65
66EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand = {
67 L"tftp",
68 TftpCommandHandler,
69 TftpCommandGetHelp
70};
71
72/**
73 Entry point of Tftp Dynamic Command.
74
75 Produce the DynamicCommand protocol to handle "tftp" command.
76
77 @param ImageHandle The image handle of the process.
78 @param SystemTable The EFI System Table pointer.
79
80 @retval EFI_SUCCESS Tftp command is executed sucessfully.
81 @retval EFI_ABORTED HII package was failed to initialize.
82 @retval others Other errors when executing tftp command.
83**/
84EFI_STATUS
85EFIAPI
86TftpCommandInitialize (
87 IN EFI_HANDLE ImageHandle,
88 IN EFI_SYSTEM_TABLE *SystemTable
89 )
90{
91 EFI_STATUS Status;
92 mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
93 if (mTftpHiiHandle == NULL) {
94 return EFI_ABORTED;
95 }
96
97 Status = gBS->InstallProtocolInterface (
98 &ImageHandle,
99 &gEfiShellDynamicCommandProtocolGuid,
100 EFI_NATIVE_INTERFACE,
101 &mTftpDynamicCommand
102 );
103 ASSERT_EFI_ERROR (Status);
104 return Status;
105}
106
107/**
108 Tftp driver unload handler.
109
110 @param ImageHandle The image handle of the process.
111
112 @retval EFI_SUCCESS The image is unloaded.
113 @retval Others Failed to unload the image.
114**/
115EFI_STATUS
116EFIAPI
117TftpUnload (
118 IN EFI_HANDLE ImageHandle
119)
120{
121 EFI_STATUS Status;
122 Status = gBS->UninstallProtocolInterface (
123 ImageHandle,
124 &gEfiShellDynamicCommandProtocolGuid,
125 &mTftpDynamicCommand
126 );
127 if (EFI_ERROR (Status)) {
128 return Status;
129 }
130 HiiRemovePackages (mTftpHiiHandle);
131 return EFI_SUCCESS;
132}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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