2 Configuration application for the EBC Debugger.
4 Copyright (c) 2007 - 2016, 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
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.
16 #include <Protocol/ShellParameters.h>
18 #include "EdbCommon.h"
19 #include "EdbSupport.h"
23 The function that displays the utility usage message.
32 L
"EbcDebuggerConfig Version 1.0\n"
33 L
"Copyright (C) Intel Corp 2007-2016. All rights reserved.\n"
35 L
"Configure EbcDebugger in EFI Shell Environment.\n"
37 L
"usage: EdbCfg <Command>\n"
39 L
" BO[C|CX|R|E|T|K] <ON|OFF> - Enable/Disable BOC/BOCX/BOR/BOE/BOT/BOK.\n"
40 // L" SHOWINFO - Show Debugger Information.\n"
48 The function is to show some information.
50 @param DebuggerConfiguration Point to the EFI_DEBUGGER_CONFIGURATION_PROTOCOL.
55 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
58 Print (L
"Not supported!\n");
64 EdbConfigBreak function.
66 @param DebuggerConfiguration Point to the EFI_DEBUGGER_CONFIGURATION_PROTOCOL.
67 @param Command Point to the command.
68 @param CommandArg The argument for this command.
73 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
,
78 EFI_DEBUGGER_PRIVATE_DATA
*DebuggerPrivate
;
80 DebuggerPrivate
= (EFI_DEBUGGER_PRIVATE_DATA
*)DebuggerConfiguration
->DebuggerPrivateData
;
82 if (StriCmp (Command
, L
"BOC") == 0) {
83 if (CommandArg
== NULL
) {
84 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOC
) == EFI_DEBUG_FLAG_EBC_BOC
) {
89 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
90 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOC
;
91 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
92 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOC
;
94 Print (L
"Invalid parameter\n");
96 } else if (StriCmp (Command
, L
"BOCX") == 0) {
97 if (CommandArg
== NULL
) {
98 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOCX
) == EFI_DEBUG_FLAG_EBC_BOCX
) {
101 Print (L
"BOCX off\n");
103 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
104 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOCX
;
105 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
106 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOCX
;
108 Print (L
"Invalid parameter\n");
110 } else if (StriCmp (Command
, L
"BOR") == 0) {
111 if (CommandArg
== NULL
) {
112 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOR
) == EFI_DEBUG_FLAG_EBC_BOR
) {
115 Print (L
"BOR off\n");
117 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
118 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOR
;
119 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
120 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOR
;
122 Print (L
"Invalid parameter\n");
124 } else if (StriCmp (Command
, L
"BOE") == 0) {
125 if (CommandArg
== NULL
) {
126 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOE
) == EFI_DEBUG_FLAG_EBC_BOE
) {
129 Print (L
"BOE off\n");
131 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
132 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOE
;
133 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
134 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOE
;
136 Print (L
"Invalid parameter\n");
138 } else if (StriCmp (Command
, L
"BOT") == 0) {
139 if (CommandArg
== NULL
) {
140 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOT
) == EFI_DEBUG_FLAG_EBC_BOT
) {
143 Print (L
"BOT off\n");
145 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
146 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOT
;
147 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
148 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOT
;
150 Print (L
"Invalid parameter\n");
152 } else if (StriCmp (Command
, L
"BOK") == 0) {
153 if (CommandArg
== NULL
) {
154 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOK
) == EFI_DEBUG_FLAG_EBC_BOK
) {
157 Print (L
"BOK off\n");
159 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
160 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOK
;
161 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
162 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOK
;
164 Print (L
"Invalid parameter\n");
171 Alter the EBC Debugger configuration.
173 @param[in] ImageHandle The image handle.
174 @param[in] SystemTable The system table.
176 @retval EFI_SUCCESS Operation completed successfully.
177 @retval EFI_INVALID_PARAMETER Usage error.
178 @retval EFI_NOT_FOUND A running debugger cannot be located.
182 InitializeEbcDebuggerConfig (
183 IN EFI_HANDLE ImageHandle
,
184 IN EFI_SYSTEM_TABLE
*SystemTable
189 EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
;
190 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
;
193 Status
= gBS
->HandleProtocol (
195 &gEfiShellParametersProtocolGuid
,
196 (VOID
**)&ShellParameters
198 if (EFI_ERROR(Status
)) {
199 Print (L
"Please use UEFI Shell to run this application.\n");
200 return EFI_INVALID_PARAMETER
;
203 Argc
= ShellParameters
->Argc
;
204 Argv
= ShellParameters
->Argv
;
208 return EFI_INVALID_PARAMETER
;
212 if ((StrCmp (Argv
[1], L
"/?") == 0) ||
213 (StrCmp (Argv
[1], L
"-?") == 0) ||
214 (StrCmp (Argv
[1], L
"-h") == 0) ||
215 (StrCmp (Argv
[1], L
"-H") == 0) ) {
221 Status
= gBS
->LocateProtocol (
222 &gEfiDebuggerConfigurationProtocolGuid
,
224 (VOID
**)&DebuggerConfiguration
226 if (EFI_ERROR(Status
)) {
227 Print (L
"Error: DebuggerConfiguration protocol not found.\n");
228 return EFI_NOT_FOUND
;
231 if (StriCmp (Argv
[1], L
"SHOWINFO") == 0) {
232 EdbShowInfo (DebuggerConfiguration
);
236 if (((Argc
== 2) || (Argc
== 3)) &&
237 ((StriCmp (Argv
[1], L
"BOC") == 0) ||
238 (StriCmp (Argv
[1], L
"BOCX") == 0) ||
239 (StriCmp (Argv
[1], L
"BOR") == 0) ||
240 (StriCmp (Argv
[1], L
"BOE") == 0) ||
241 (StriCmp (Argv
[1], L
"BOT") == 0) ||
242 (StriCmp (Argv
[1], L
"BOK") == 0))) {
244 EdbConfigBreak (DebuggerConfiguration
, Argv
[1], Argv
[2]);
246 EdbConfigBreak (DebuggerConfiguration
, Argv
[1], NULL
);
251 Print (L
"Error: Invalid Command.\n");
252 return EFI_INVALID_PARAMETER
;