TianoCore EDK2 master
Loading...
Searching...
No Matches
EbcDebuggerConfig.c
Go to the documentation of this file.
1
9#include <Uefi.h>
11
12#include "EdbCommon.h"
13#include "EdbSupport.h"
14
20VOID
22 VOID
23 )
24{
25 Print (
26 L"EbcDebuggerConfig Version 1.0\n"
27 L"Copyright (C) Intel Corp 2007-2016. All rights reserved.\n"
28 L"\n"
29 L"Configure EbcDebugger in EFI Shell Environment.\n"
30 L"\n"
31 L"usage: EdbCfg <Command>\n"
32 L" CommandList:\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"
35 L"\n"
36 );
37 return;
38}
39
47VOID
49 EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration
50 )
51{
52 Print (L"Not supported!\n");
53 return;
54}
55
65VOID
67 EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration,
68 CHAR16 *Command,
69 CHAR16 *CommandArg
70 )
71{
72 EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate;
73
74 DebuggerPrivate = (EFI_DEBUGGER_PRIVATE_DATA *)DebuggerConfiguration->DebuggerPrivateData;
75
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) {
79 Print (L"BOC on\n");
80 } else {
81 Print (L"BOC off\n");
82 }
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;
87 } else {
88 Print (L"Invalid parameter\n");
89 }
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) {
93 Print (L"BOCX on\n");
94 } else {
95 Print (L"BOCX off\n");
96 }
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;
101 } else {
102 Print (L"Invalid parameter\n");
103 }
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) {
107 Print (L"BOR on\n");
108 } else {
109 Print (L"BOR off\n");
110 }
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;
115 } else {
116 Print (L"Invalid parameter\n");
117 }
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) {
121 Print (L"BOE on\n");
122 } else {
123 Print (L"BOE off\n");
124 }
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;
129 } else {
130 Print (L"Invalid parameter\n");
131 }
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) {
135 Print (L"BOT on\n");
136 } else {
137 Print (L"BOT off\n");
138 }
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;
143 } else {
144 Print (L"Invalid parameter\n");
145 }
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) {
149 Print (L"BOK on\n");
150 } else {
151 Print (L"BOK off\n");
152 }
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;
157 } else {
158 Print (L"Invalid parameter\n");
159 }
160 }
161
162 return;
163}
164
176EFIAPI
178 IN EFI_HANDLE ImageHandle,
179 IN EFI_SYSTEM_TABLE *SystemTable
180 )
181{
182 UINTN Argc;
183 CHAR16 **Argv;
184 EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters;
185 EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration;
186 EFI_STATUS Status;
187
188 Status = gBS->HandleProtocol (
190 &gEfiShellParametersProtocolGuid,
191 (VOID **)&ShellParameters
192 );
193 if (EFI_ERROR (Status)) {
194 Print (L"Please use UEFI Shell to run this application.\n");
195 return EFI_INVALID_PARAMETER;
196 }
197
198 Argc = ShellParameters->Argc;
199 Argv = ShellParameters->Argv;
200
201 if (Argc < 2) {
202 PrintUsage ();
203 return EFI_INVALID_PARAMETER;
204 }
205
206 if (Argc == 2) {
207 if ((StrCmp (Argv[1], L"/?") == 0) ||
208 (StrCmp (Argv[1], L"-?") == 0) ||
209 (StrCmp (Argv[1], L"-h") == 0) ||
210 (StrCmp (Argv[1], L"-H") == 0))
211 {
212 PrintUsage ();
213 return EFI_SUCCESS;
214 }
215 }
216
217 Status = gBS->LocateProtocol (
218 &gEfiDebuggerConfigurationProtocolGuid,
219 NULL,
220 (VOID **)&DebuggerConfiguration
221 );
222 if (EFI_ERROR (Status)) {
223 Print (L"Error: DebuggerConfiguration protocol not found.\n");
224 return EFI_NOT_FOUND;
225 }
226
227 if (StriCmp (Argv[1], L"SHOWINFO") == 0) {
228 EdbShowInfo (DebuggerConfiguration);
229 return EFI_SUCCESS;
230 }
231
232 if (((Argc == 2) || (Argc == 3)) &&
233 ((StriCmp (Argv[1], L"BOC") == 0) ||
234 (StriCmp (Argv[1], L"BOCX") == 0) ||
235 (StriCmp (Argv[1], L"BOR") == 0) ||
236 (StriCmp (Argv[1], L"BOE") == 0) ||
237 (StriCmp (Argv[1], L"BOT") == 0) ||
238 (StriCmp (Argv[1], L"BOK") == 0)))
239 {
240 if (Argc == 3) {
241 EdbConfigBreak (DebuggerConfiguration, Argv[1], Argv[2]);
242 } else {
243 EdbConfigBreak (DebuggerConfiguration, Argv[1], NULL);
244 }
245
246 return EFI_SUCCESS;
247 }
248
249 Print (L"Error: Invalid Command.\n");
250 return EFI_INVALID_PARAMETER;
251}
UINT64 UINTN
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
Definition: String.c:109
VOID EdbShowInfo(EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration)
VOID EdbConfigBreak(EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration, CHAR16 *Command, CHAR16 *CommandArg)
EFI_STATUS EFIAPI InitializeEbcDebuggerConfig(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID PrintUsage(VOID)
INTN EFIAPI StriCmp(IN CHAR16 *String, IN CHAR16 *String2)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_HANDLE gImageHandle
EFI_BOOT_SERVICES * gBS
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113