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 | This program and the accompanying materials
|
---|
6 | are licensed and made available under the terms and conditions of the BSD License
|
---|
7 | which accompanies this distribution. The full text of the license may be found at
|
---|
8 | http://opensource.org/licenses/bsd-license.php
|
---|
9 |
|
---|
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
12 |
|
---|
13 | **/
|
---|
14 |
|
---|
15 | #include "UefiShellDriver1CommandsLib.h"
|
---|
16 |
|
---|
17 | STATIC CONST CHAR16 mFileName[] = L"Driver1Commands";
|
---|
18 | EFI_HANDLE gShellDriver1HiiHandle = NULL;
|
---|
19 | BOOLEAN gInReconnect = FALSE;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | Function to return the name of the file containing help if HII will not be used.
|
---|
23 |
|
---|
24 | @return The filename.
|
---|
25 | **/
|
---|
26 | CONST CHAR16*
|
---|
27 | EFIAPI
|
---|
28 | ShellCommandGetManFileNameDriver1 (
|
---|
29 | VOID
|
---|
30 | )
|
---|
31 | {
|
---|
32 | return (mFileName);
|
---|
33 | }
|
---|
34 |
|
---|
35 | /**
|
---|
36 | Constructor for the Shell Driver1 Commands library.
|
---|
37 |
|
---|
38 | @param ImageHandle the image handle of the process
|
---|
39 | @param SystemTable the EFI System Table pointer
|
---|
40 |
|
---|
41 | @retval EFI_SUCCESS the shell command handlers were installed sucessfully
|
---|
42 | @retval EFI_UNSUPPORTED the shell level required was not found.
|
---|
43 | **/
|
---|
44 | EFI_STATUS
|
---|
45 | EFIAPI
|
---|
46 | UefiShellDriver1CommandsLibConstructor (
|
---|
47 | IN EFI_HANDLE ImageHandle,
|
---|
48 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
49 | )
|
---|
50 | {
|
---|
51 | //
|
---|
52 | // check our bit of the profiles mask
|
---|
53 | //
|
---|
54 | if ((PcdGet8(PcdShellProfileMask) & BIT0) == 0) {
|
---|
55 | return (EFI_SUCCESS);
|
---|
56 | }
|
---|
57 |
|
---|
58 | //
|
---|
59 | // install the HII stuff.
|
---|
60 | //
|
---|
61 | gShellDriver1HiiHandle = HiiAddPackages (&gShellDriver1HiiGuid, gImageHandle, UefiShellDriver1CommandsLibStrings, NULL);
|
---|
62 | if (gShellDriver1HiiHandle == NULL) {
|
---|
63 | return (EFI_DEVICE_ERROR);
|
---|
64 | }
|
---|
65 |
|
---|
66 | //
|
---|
67 | // install our shell command handlers that are always installed
|
---|
68 | //
|
---|
69 | ShellCommandRegisterCommandName(L"connect", ShellCommandRunConnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_CONNECT) );
|
---|
70 | ShellCommandRegisterCommandName(L"devices", ShellCommandRunDevices , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DEVICES) );
|
---|
71 | ShellCommandRegisterCommandName(L"openinfo", ShellCommandRunOpenInfo , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_OPENINFO) );
|
---|
72 | ShellCommandRegisterCommandName(L"disconnect", ShellCommandRunDisconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DISCONNECT));
|
---|
73 | ShellCommandRegisterCommandName(L"reconnect", ShellCommandRunReconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_RECONNECT) );
|
---|
74 | ShellCommandRegisterCommandName(L"unload", ShellCommandRunUnload , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_UNLOAD) );
|
---|
75 | ShellCommandRegisterCommandName(L"drvdiag", ShellCommandRunDrvDiag , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRVDIAG) );
|
---|
76 | ShellCommandRegisterCommandName(L"dh", ShellCommandRunDh , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DH) );
|
---|
77 | ShellCommandRegisterCommandName(L"drivers", ShellCommandRunDrivers , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRIVERS) );
|
---|
78 | ShellCommandRegisterCommandName(L"devtree", ShellCommandRunDevTree , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DEVTREE) );
|
---|
79 | ShellCommandRegisterCommandName(L"drvcfg", ShellCommandRunDrvCfg , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRVCFG) );
|
---|
80 |
|
---|
81 | return (EFI_SUCCESS);
|
---|
82 | }
|
---|
83 |
|
---|
84 | /**
|
---|
85 | Destructor for the library. free any resources.
|
---|
86 |
|
---|
87 | @param ImageHandle The image handle of the process.
|
---|
88 | @param SystemTable The EFI System Table pointer.
|
---|
89 | **/
|
---|
90 | EFI_STATUS
|
---|
91 | EFIAPI
|
---|
92 | UefiShellDriver1CommandsLibDestructor (
|
---|
93 | IN EFI_HANDLE ImageHandle,
|
---|
94 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
95 | )
|
---|
96 | {
|
---|
97 | if (gShellDriver1HiiHandle != NULL) {
|
---|
98 | HiiRemovePackages(gShellDriver1HiiHandle);
|
---|
99 | }
|
---|
100 | return (EFI_SUCCESS);
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|