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"
27 L
"EbcDebuggerConfig Version 1.0\n"
28 L
"Copyright (C) Intel Corp 2007-2016. All rights reserved.\n"
30 L
"Configure EbcDebugger in EFI Shell Environment.\n"
32 L
"usage: EdbCfg <Command>\n"
34 L
" BO[C|CX|R|E|T|K] <ON|OFF> - Enable/Disable BOC/BOCX/BOR/BOE/BOT/BOK.\n"
35 // L" SHOWINFO - Show Debugger Information.\n"
43 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
46 Print (L
"Not supported!\n");
52 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
,
57 EFI_DEBUGGER_PRIVATE_DATA
*DebuggerPrivate
;
59 DebuggerPrivate
= (EFI_DEBUGGER_PRIVATE_DATA
*)DebuggerConfiguration
->DebuggerPrivateData
;
61 if (StriCmp (Command
, L
"BOC") == 0) {
62 if (CommandArg
== NULL
) {
63 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOC
) == EFI_DEBUG_FLAG_EBC_BOC
) {
68 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
69 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOC
;
70 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
71 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOC
;
73 Print (L
"Invalid parameter\n");
75 } else if (StriCmp (Command
, L
"BOCX") == 0) {
76 if (CommandArg
== NULL
) {
77 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOCX
) == EFI_DEBUG_FLAG_EBC_BOCX
) {
80 Print (L
"BOCX off\n");
82 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
83 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOCX
;
84 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
85 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOCX
;
87 Print (L
"Invalid parameter\n");
89 } else if (StriCmp (Command
, L
"BOR") == 0) {
90 if (CommandArg
== NULL
) {
91 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOR
) == EFI_DEBUG_FLAG_EBC_BOR
) {
96 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
97 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOR
;
98 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
99 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOR
;
101 Print (L
"Invalid parameter\n");
103 } else if (StriCmp (Command
, L
"BOE") == 0) {
104 if (CommandArg
== NULL
) {
105 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOE
) == EFI_DEBUG_FLAG_EBC_BOE
) {
108 Print (L
"BOE off\n");
110 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
111 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOE
;
112 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
113 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOE
;
115 Print (L
"Invalid parameter\n");
117 } else if (StriCmp (Command
, L
"BOT") == 0) {
118 if (CommandArg
== NULL
) {
119 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOT
) == EFI_DEBUG_FLAG_EBC_BOT
) {
122 Print (L
"BOT off\n");
124 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
125 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOT
;
126 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
127 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOT
;
129 Print (L
"Invalid parameter\n");
131 } else if (StriCmp (Command
, L
"BOK") == 0) {
132 if (CommandArg
== NULL
) {
133 if ((DebuggerPrivate
->FeatureFlags
& EFI_DEBUG_FLAG_EBC_BOK
) == EFI_DEBUG_FLAG_EBC_BOK
) {
136 Print (L
"BOK off\n");
138 } else if (StriCmp (CommandArg
, L
"ON") == 0) {
139 DebuggerPrivate
->FeatureFlags
|= EFI_DEBUG_FLAG_EBC_BOK
;
140 } else if (StriCmp (CommandArg
, L
"OFF") == 0) {
141 DebuggerPrivate
->FeatureFlags
&= ~EFI_DEBUG_FLAG_EBC_B_BOK
;
143 Print (L
"Invalid parameter\n");
150 Alter the EBC Debugger configuration.
152 @param[in] ImageHandle The image handle.
153 @param[in] SystemTable The system table.
155 @retval EFI_SUCCESS Operation completed successfully.
156 @retval EFI_INVALID_PARAMETER Usage error.
157 @retval EFI_NOT_FOUND A running debugger cannot be located.
161 InitializeEbcDebuggerConfig (
162 IN EFI_HANDLE ImageHandle
,
163 IN EFI_SYSTEM_TABLE
*SystemTable
168 EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
;
169 EFI_DEBUGGER_CONFIGURATION_PROTOCOL
*DebuggerConfiguration
;
172 Status
= gBS
->HandleProtocol (
174 &gEfiShellParametersProtocolGuid
,
175 (VOID
**)&ShellParameters
177 if (EFI_ERROR(Status
)) {
178 Print (L
"Please use UEFI Shell to run this application.\n");
179 return EFI_INVALID_PARAMETER
;
182 Argc
= ShellParameters
->Argc
;
183 Argv
= ShellParameters
->Argv
;
187 return EFI_INVALID_PARAMETER
;
191 if ((StrCmp (Argv
[1], L
"/?") == 0) ||
192 (StrCmp (Argv
[1], L
"-?") == 0) ||
193 (StrCmp (Argv
[1], L
"-h") == 0) ||
194 (StrCmp (Argv
[1], L
"-H") == 0) ) {
200 Status
= gBS
->LocateProtocol (
201 &gEfiDebuggerConfigurationProtocolGuid
,
203 (VOID
**)&DebuggerConfiguration
205 if (EFI_ERROR(Status
)) {
206 Print (L
"Error: DebuggerConfiguration protocol not found.\n");
207 return EFI_NOT_FOUND
;
210 if (StriCmp (Argv
[1], L
"SHOWINFO") == 0) {
211 EdbShowInfo (DebuggerConfiguration
);
215 if (((Argc
== 2) || (Argc
== 3)) &&
216 ((StriCmp (Argv
[1], L
"BOC") == 0) ||
217 (StriCmp (Argv
[1], L
"BOCX") == 0) ||
218 (StriCmp (Argv
[1], L
"BOR") == 0) ||
219 (StriCmp (Argv
[1], L
"BOE") == 0) ||
220 (StriCmp (Argv
[1], L
"BOT") == 0) ||
221 (StriCmp (Argv
[1], L
"BOK") == 0))) {
223 EdbConfigBreak (DebuggerConfiguration
, Argv
[1], Argv
[2]);
225 EdbConfigBreak (DebuggerConfiguration
, Argv
[1], NULL
);
230 Print (L
"Error: Invalid Command.\n");
231 return EFI_INVALID_PARAMETER
;