2 Configuration application for the EBC Debugger.
4 Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Protocol/ShellParameters.h>
12 #include "EdbCommon.h"
13 #include "EdbSupport.h"
17 The function that displays the utility usage message.
26 L
"EbcDebuggerConfig Version 1.0\n"
27 L
"Copyright (C) Intel Corp 2007-2016. All rights reserved.\n"
29 L
"Configure EbcDebugger in EFI Shell Environment.\n"
31 L
"usage: EdbCfg <Command>\n"
33 L
" BO[C|CX|R|E|T|K] <ON|OFF> - Enable/Disable BOC/BOCX/BOR/BOE/BOT/BOK.\n"
34 // L" SHOWINFO - Show Debugger Information.\n"
42 The function is to show some information.
44 @param DebuggerConfiguration Point to the EFI_DEBUGGER_CONFIGURATION_PROTOCOL.
49 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
52 Print (L
"Not supported!\n");
58 EdbConfigBreak function.
60 @param DebuggerConfiguration Point to the EFI_DEBUGGER_CONFIGURATION_PROTOCOL.
61 @param Command Point to the command.
62 @param CommandArg The argument for this command.
67 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
,
72 EFI_DEBUGGER_PRIVATE_DATA
*DebuggerPrivate
;
74 DebuggerPrivate
= (EFI_DEBUGGER_PRIVATE_DATA
*)DebuggerConfiguration
->DebuggerPrivateData
;
76 if (StriCmp (Command
, L
"BOC") == 0) {
77 if (CommandArg
== NULL
) {
78 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOC
) == EFI_DEBUG_FLAG_EBC_BOC
) {
83 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
84 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOC
;
85 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
86 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOC
;
88 Print (L
"Invalid parameter\n");
90 } else if (StriCmp (Command
, L
"BOCX") == 0) {
91 if (CommandArg
== NULL
) {
92 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOCX
) == EFI_DEBUG_FLAG_EBC_BOCX
) {
95 Print (L
"BOCX off\n");
97 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
98 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOCX
;
99 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
100 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOCX
;
102 Print (L
"Invalid parameter\n");
104 } else if (StriCmp (Command
, L
"BOR") == 0) {
105 if (CommandArg
== NULL
) {
106 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOR
) == EFI_DEBUG_FLAG_EBC_BOR
) {
109 Print (L
"BOR off\n");
111 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
112 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOR
;
113 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
114 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOR
;
116 Print (L
"Invalid parameter\n");
118 } else if (StriCmp (Command
, L
"BOE") == 0) {
119 if (CommandArg
== NULL
) {
120 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOE
) == EFI_DEBUG_FLAG_EBC_BOE
) {
123 Print (L
"BOE off\n");
125 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
126 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOE
;
127 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
128 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOE
;
130 Print (L
"Invalid parameter\n");
132 } else if (StriCmp (Command
, L
"BOT") == 0) {
133 if (CommandArg
== NULL
) {
134 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOT
) == EFI_DEBUG_FLAG_EBC_BOT
) {
137 Print (L
"BOT off\n");
139 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
140 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOT
;
141 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
142 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOT
;
144 Print (L
"Invalid parameter\n");
146 } else if (StriCmp (Command
, L
"BOK") == 0) {
147 if (CommandArg
== NULL
) {
148 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOK
) == EFI_DEBUG_FLAG_EBC_BOK
) {
151 Print (L
"BOK off\n");
153 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
154 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOK
;
155 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
156 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOK
;
158 Print (L
"Invalid parameter\n");
165 Alter the EBC Debugger configuration.
167 @param[in] ImageHandle The image handle.
168 @param[in] SystemTable The system table.
170 @retval EFI_SUCCESS Operation completed successfully.
171 @retval EFI_INVALID_PARAMETER Usage error.
172 @retval EFI_NOT_FOUND A running debugger cannot be located.
176 InitializeEbcDebuggerConfig (
177 IN EFI_HANDLE ImageHandle
,
178 IN EFI_SYSTEM_TABLE
*SystemTable
183 EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
;
184 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
;
187 Status
= gBS
->HandleProtocol (
189 &gEfiShellParametersProtocolGuid
,
190 (VOID
**)&ShellParameters
192 if (EFI_ERROR(Status
)) {
193 Print (L
"Please use UEFI Shell to run this application.\n");
194 return EFI_INVALID_PARAMETER
;
197 Argc
= ShellParameters
->Argc
;
198 Argv
= ShellParameters
->Argv
;
202 return EFI_INVALID_PARAMETER
;
206 if ((StrCmp (Argv
[1], L
"/?") == 0) ||
207 (StrCmp (Argv
[1], L
"-?") == 0) ||
208 (StrCmp (Argv
[1], L
"-h") == 0) ||
209 (StrCmp (Argv
[1], L
"-H") == 0) ) {
215 Status
= gBS
->LocateProtocol (
216 &gEfiDebuggerConfigurationProtocolGuid
,
218 (VOID
**)&DebuggerConfiguration
220 if (EFI_ERROR(Status
)) {
221 Print (L
"Error: DebuggerConfiguration protocol not found.\n");
222 return EFI_NOT_FOUND
;
225 if (StriCmp (Argv
[1], L
"SHOWINFO") == 0) {
226 EdbShowInfo (DebuggerConfiguration
);
230 if (((Argc
== 2) || (Argc
== 3)) &&
231 ((StriCmp (Argv
[1], L
"BOC") == 0) ||
232 (StriCmp (Argv
[1], L
"BOCX") == 0) ||
233 (StriCmp (Argv
[1], L
"BOR") == 0) ||
234 (StriCmp (Argv
[1], L
"BOE") == 0) ||
235 (StriCmp (Argv
[1], L
"BOT") == 0) ||
236 (StriCmp (Argv
[1], L
"BOK") == 0))) {
238 EdbConfigBreak (DebuggerConfiguration
, Argv
[1], Argv
[2]);
240 EdbConfigBreak (DebuggerConfiguration
, Argv
[1], NULL
);
245 Print (L
"Error: Invalid Command.\n");
246 return EFI_INVALID_PARAMETER
;