12STATIC CONST EFI_GUID *DiagGuidList[] = { &gEfiDriverDiagnosticsProtocolGuid, &gEfiDriverDiagnostics2ProtocolGuid,
NULL };
40 IN CONST DRV_DIAG_TEST_MODE Mode,
54 UINTN DriverHandleListCount;
55 UINTN ControllerHandleListCount;
56 UINTN ChildHandleListCount;
57 UINTN DriverHandleListLoop;
58 UINTN ControllerHandleListLoop;
59 UINTN ChildHandleListLoop;
70 if (((ChildHandle !=
NULL) && AllChilds) || (Mode >= TestModeMax)) {
71 return (EFI_INVALID_PARAMETER);
74 DriverDiagnostics =
NULL;
75 DriverDiagnostics2 =
NULL;
78 DriverHandleList =
NULL;
79 ControllerHandleList =
NULL;
80 ChildHandleList =
NULL;
84 DriverHandleListCount = 0;
85 ControllerHandleListCount = 0;
86 ChildHandleListCount = 0;
88 if (DriverHandle !=
NULL) {
90 if (DriverHandleList ==
NULL) {
91 return EFI_OUT_OF_RESOURCES;
94 DriverHandleList[0] = DriverHandle;
95 DriverHandleListCount = 1;
98 if (DriverHandleList ==
NULL) {
99 ShellPrintHiiEx (-1, -1,
NULL,
STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L
"drvdiag", L
"gEfiDriverDiagnosticsProtocolGuid", &gEfiDriverDiagnosticsProtocolGuid);
100 ShellPrintHiiEx (-1, -1,
NULL,
STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L
"drvdiag", L
"gEfiDriverDiagnostics2ProtocolGuid", &gEfiDriverDiagnostics2ProtocolGuid);
101 return (EFI_NOT_FOUND);
104 for (Walker = DriverHandleList; Walker !=
NULL && *Walker !=
NULL; DriverHandleListCount++, Walker++) {
108 if (ControllerHandle !=
NULL) {
110 if (ControllerHandleList ==
NULL) {
111 Status2 = EFI_OUT_OF_RESOURCES;
115 ControllerHandleList[0] = ControllerHandle;
116 ControllerHandleListCount = 1;
118 ControllerHandleList =
NULL;
121 if (ChildHandle !=
NULL) {
123 if (ChildHandleList ==
NULL) {
124 Status2 = EFI_OUT_OF_RESOURCES;
128 ChildHandleList[0] = ChildHandle;
129 ChildHandleListCount = 1;
130 }
else if (AllChilds) {
131 ChildHandleList =
NULL;
136 ChildHandleList =
NULL;
139 if (Mode == TestModeList) {
143 for (DriverHandleListLoop = 0
144 ; DriverHandleListLoop < DriverHandleListCount
145 ; DriverHandleListLoop++
148 if (Mode == TestModeList) {
152 if (ControllerHandle ==
NULL) {
156 if ((ControllerHandleListCount == 0) || (ControllerHandleList ==
NULL)) {
157 if (Mode == TestModeList) {
161 if (Mode == TestModeList) {
165 for (ControllerHandleListLoop = 0
166 ; ControllerHandleListLoop < ControllerHandleListCount
167 ; ControllerHandleListLoop++
171 ASSERT (ChildHandleList ==
NULL);
173 DriverHandleList[DriverHandleListLoop],
174 ControllerHandleList[ControllerHandleListLoop],
175 &ChildHandleListCount,
180 for (ChildHandleListLoop = 0
181 ; (ChildHandleListLoop < ChildHandleListCount || ChildHandleList ==
NULL)
182 ; ChildHandleListLoop++
186 if (Mode != TestModeList) {
187 if ((Lang ==
NULL) || (Lang[2] ==
'-')) {
191 Status =
gBS->OpenProtocol (
192 DriverHandleList[DriverHandleListLoop],
193 &gEfiDriverDiagnostics2ProtocolGuid,
194 (VOID **)&DriverDiagnostics2,
197 EFI_OPEN_PROTOCOL_GET_PROTOCOL
199 if (!EFI_ERROR (Status) && (DriverDiagnostics2 !=
NULL)) {
201 if (Language ==
NULL) {
202 Status2 = EFI_NOT_FOUND;
207 Status = DriverDiagnostics2->RunDiagnostics (
209 ControllerHandleList[ControllerHandleListLoop],
210 ChildHandleList ==
NULL ?
NULL : ChildHandleList[ChildHandleListLoop],
222 if (!Found && ((Lang ==
NULL) || ((Lang !=
NULL) && (Lang[2] !=
'-')))) {
223 Status =
gBS->OpenProtocol (
224 DriverHandleList[DriverHandleListLoop],
225 &gEfiDriverDiagnosticsProtocolGuid,
226 (VOID **)&DriverDiagnostics,
229 EFI_OPEN_PROTOCOL_GET_PROTOCOL
231 if (!EFI_ERROR (Status)) {
233 if (Language ==
NULL) {
234 Status2 = EFI_NOT_FOUND;
238 Status = DriverDiagnostics->RunDiagnostics (
240 ControllerHandleList[ControllerHandleListLoop],
241 ChildHandleList ==
NULL ?
NULL : ChildHandleList[ChildHandleListLoop],
253 if (EFI_ERROR (Status)) {
264 gShellDriver1HiiHandle,
271 if (OutBuffer !=
NULL) {
276 if (ErrorType !=
NULL) {
291 gShellDriver1HiiHandle,
301 if (ChildHandleList ==
NULL) {
307 SHELL_FREE_NON_NULL (ChildHandleList);
308 ChildHandleList =
NULL;
309 ChildHandleListCount = 0;
313 if (ControllerHandle ==
NULL) {
314 SHELL_FREE_NON_NULL (ControllerHandleList);
315 ControllerHandleList =
NULL;
316 ControllerHandleListCount = 0;
323 SHELL_FREE_NON_NULL (DriverHandleList);
324 SHELL_FREE_NON_NULL (ControllerHandleList);
325 SHELL_FREE_NON_NULL (ChildHandleList);
326 SHELL_FREE_NON_NULL (Language);
327 SHELL_FREE_NON_NULL (OutBuffer);
356 CHAR16 *ProblemParam;
358 DRV_DIAG_TEST_MODE Mode;
360 CONST CHAR16 *DriverHandleStr;
361 CONST CHAR16 *ControllerHandleStr;
362 CONST CHAR16 *ChildHandleStr;
386 if (EFI_ERROR (Status)) {
387 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
418 Mode = TestModeStandard;
420 Mode = TestModeExtended;
422 Mode = TestModeManufacturing;
435 ASSERT (Language ==
NULL);
439 }
else if (Lang !=
NULL) {
441 if (Language ==
NULL) {
481 SHELL_FREE_NON_NULL (Language);
486 if (Status == EFI_SECURITY_VIOLATION) {
488 }
else if (Status == EFI_INVALID_PARAMETER) {
490 }
else if (Status == EFI_NOT_FOUND) {
492 }
else if (EFI_ERROR (Status)) {
497 return (ShellStatus);
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
EFI_DRIVER_DIAGNOSTIC_TYPE
@ EfiDriverDiagnosticTypeExtended
@ EfiDriverDiagnosticTypeManufacturing
@ EfiDriverDiagnosticTypeStandard
SHELL_STATUS EFIAPI ShellCommandRunDrvDiag(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS DoDiagnostics(IN CONST DRV_DIAG_TEST_MODE Mode, IN CONST CHAR8 *Lang, IN CONST BOOLEAN AllChilds, IN CONST EFI_HANDLE DriverHandle, IN CONST EFI_HANDLE ControllerHandle, IN CONST EFI_HANDLE ChildHandle)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define PARSE_HANDLE_DATABASE_MANAGED_CHILDREN(DriverHandle, ControllerHandle, Count, Buffer)
CHAR8 *EFIAPI GetBestLanguageForDriver(IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *InputLanguage, IN BOOLEAN Iso639Language)
EFI_HANDLE EFIAPI ConvertHandleIndexToHandle(IN CONST UINTN TheIndex)
#define PARSE_HANDLE_DATABASE_DEVICES(DriverHandle, Count, Buffer)
UINTN EFIAPI ConvertHandleToHandleIndex(IN CONST EFI_HANDLE TheHandle)
EFI_HANDLE *EFIAPI GetHandleListByProtocolList(IN CONST EFI_GUID **ProtocolGuids)
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_SECURITY_VIOLATION
@ SHELL_INVALID_PARAMETER
EFI_STATUS EFIAPI CommandInit(VOID)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
@ TypeFlag
A flag that is present or not present only (IE "-a").
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellConvertStringToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
CHAR8 * SupportedLanguages