VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c

Last change on this file was 105670, checked in by vboxsync, 6 months ago

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • Property svn:eol-style set to native
File size: 4.0 KB
Line 
1/** @file
2 Main file for NULL named library for level 1 shell command functions.
3
4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include "UefiShellDriver1CommandsLib.h"
10
11STATIC CONST CHAR16 mFileName[] = L"Driver1Commands";
12EFI_HII_HANDLE gShellDriver1HiiHandle = NULL;
13BOOLEAN gInReconnect = FALSE;
14
15/**
16 Function to return the name of the file containing help if HII will not be used.
17
18 @return The filename.
19**/
20CONST CHAR16 *
21EFIAPI
22ShellCommandGetManFileNameDriver1 (
23 VOID
24 )
25{
26 return (mFileName);
27}
28
29/**
30 Constructor for the Shell Driver1 Commands library.
31
32 @param ImageHandle the image handle of the process
33 @param SystemTable the EFI System Table pointer
34
35 @retval EFI_SUCCESS the shell command handlers were installed successfully
36 @retval EFI_UNSUPPORTED the shell level required was not found.
37**/
38EFI_STATUS
39EFIAPI
40UefiShellDriver1CommandsLibConstructor (
41 IN EFI_HANDLE ImageHandle,
42 IN EFI_SYSTEM_TABLE *SystemTable
43 )
44{
45 //
46 // check our bit of the profiles mask
47 //
48 if ((PcdGet8 (PcdShellProfileMask) & BIT0) == 0) {
49 return (EFI_SUCCESS);
50 }
51
52 //
53 // install the HII stuff.
54 //
55 gShellDriver1HiiHandle = HiiAddPackages (&gShellDriver1HiiGuid, gImageHandle, UefiShellDriver1CommandsLibStrings, NULL);
56 if (gShellDriver1HiiHandle == NULL) {
57 return (EFI_DEVICE_ERROR);
58 }
59
60 //
61 // install our shell command handlers that are always installed
62 //
63 ShellCommandRegisterCommandName (L"connect", ShellCommandRunConnect, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_CONNECT));
64 ShellCommandRegisterCommandName (L"devices", ShellCommandRunDevices, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DEVICES));
65 ShellCommandRegisterCommandName (L"openinfo", ShellCommandRunOpenInfo, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_OPENINFO));
66 ShellCommandRegisterCommandName (L"disconnect", ShellCommandRunDisconnect, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DISCONNECT));
67 ShellCommandRegisterCommandName (L"reconnect", ShellCommandRunReconnect, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_RECONNECT));
68 ShellCommandRegisterCommandName (L"unload", ShellCommandRunUnload, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_UNLOAD));
69 ShellCommandRegisterCommandName (L"drvdiag", ShellCommandRunDrvDiag, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DRVDIAG));
70 ShellCommandRegisterCommandName (L"dh", ShellCommandRunDh, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DH));
71 ShellCommandRegisterCommandName (L"drivers", ShellCommandRunDrivers, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DRIVERS));
72 ShellCommandRegisterCommandName (L"devtree", ShellCommandRunDevTree, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DEVTREE));
73 ShellCommandRegisterCommandName (L"drvcfg", ShellCommandRunDrvCfg, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DRVCFG));
74
75 return (EFI_SUCCESS);
76}
77
78/**
79 Destructor for the library. free any resources.
80
81 @param ImageHandle The image handle of the process.
82 @param SystemTable The EFI System Table pointer.
83**/
84EFI_STATUS
85EFIAPI
86UefiShellDriver1CommandsLibDestructor (
87 IN EFI_HANDLE ImageHandle,
88 IN EFI_SYSTEM_TABLE *SystemTable
89 )
90{
91 if (gShellDriver1HiiHandle != NULL) {
92 HiiRemovePackages (gShellDriver1HiiHandle);
93 }
94
95 return (EFI_SUCCESS);
96}
Note: See TracBrowser for help on using the repository browser.

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