VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c@ 108793

Last change on this file since 108793 was 99404, checked in by vboxsync, 2 years ago

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

  • Property svn:eol-style set to native
File size: 3.6 KB
Line 
1/** @file
2 Produce "dp" shell dynamic command.
3
4 Copyright (c) 2017, Intel Corporation. All rights reserved. <BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9#include "Dp.h"
10#include <Protocol/ShellDynamicCommand.h>
11
12/**
13 This is the shell command handler function pointer callback type. This
14 function handles the command when it is invoked in the shell.
15
16 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
17 @param[in] SystemTable The pointer to the system table.
18 @param[in] ShellParameters The parameters associated with the command.
19 @param[in] Shell The instance of the shell protocol used in the context
20 of processing this command.
21
22 @return EFI_SUCCESS the operation was successful
23 @return other the operation failed.
24**/
25SHELL_STATUS
26EFIAPI
27DpCommandHandler (
28 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
29 IN EFI_SYSTEM_TABLE *SystemTable,
30 IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
31 IN EFI_SHELL_PROTOCOL *Shell
32 )
33{
34 gEfiShellParametersProtocol = ShellParameters;
35 gEfiShellProtocol = Shell;
36 return RunDp (gImageHandle, SystemTable);
37}
38
39/**
40 This is the command help handler function pointer callback type. This
41 function is responsible for displaying help information for the associated
42 command.
43
44 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
45 @param[in] Language The pointer to the language string to use.
46
47 @return string Pool allocated help string, must be freed by caller
48**/
49CHAR16 *
50EFIAPI
51DpCommandGetHelp (
52 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
53 IN CONST CHAR8 *Language
54 )
55{
56 return HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_GET_HELP_DP), Language);
57}
58
59EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mDpDynamicCommand = {
60 L"dp",
61 DpCommandHandler,
62 DpCommandGetHelp
63};
64
65/**
66 Entry point of Tftp Dynamic Command.
67
68 Produce the DynamicCommand protocol to handle "tftp" command.
69
70 @param ImageHandle The image handle of the process.
71 @param SystemTable The EFI System Table pointer.
72
73 @retval EFI_SUCCESS Tftp command is executed successfully.
74 @retval EFI_ABORTED HII package was failed to initialize.
75 @retval others Other errors when executing tftp command.
76**/
77EFI_STATUS
78EFIAPI
79DpCommandInitialize (
80 IN EFI_HANDLE ImageHandle,
81 IN EFI_SYSTEM_TABLE *SystemTable
82 )
83{
84 EFI_STATUS Status;
85
86 mDpHiiHandle = InitializeHiiPackage (ImageHandle);
87 if (mDpHiiHandle == NULL) {
88 return EFI_ABORTED;
89 }
90
91 Status = gBS->InstallProtocolInterface (
92 &ImageHandle,
93 &gEfiShellDynamicCommandProtocolGuid,
94 EFI_NATIVE_INTERFACE,
95 &mDpDynamicCommand
96 );
97 ASSERT_EFI_ERROR (Status);
98 return Status;
99}
100
101/**
102 Tftp driver unload handler.
103
104 @param ImageHandle The image handle of the process.
105
106 @retval EFI_SUCCESS The image is unloaded.
107 @retval Others Failed to unload the image.
108**/
109EFI_STATUS
110EFIAPI
111DpUnload (
112 IN EFI_HANDLE ImageHandle
113 )
114{
115 EFI_STATUS Status;
116
117 Status = gBS->UninstallProtocolInterface (
118 ImageHandle,
119 &gEfiShellDynamicCommandProtocolGuid,
120 &mDpDynamicCommand
121 );
122 if (EFI_ERROR (Status)) {
123 return Status;
124 }
125
126 HiiRemovePackages (mDpHiiHandle);
127 return EFI_SUCCESS;
128}
Note: See TracBrowser for help on using the repository browser.

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