/** @file
Main file for DrvDiag shell Driver1 function.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "UefiShellDriver1CommandsLib.h"
STATIC CONST EFI_GUID *DiagGuidList[] = {&gEfiDriverDiagnosticsProtocolGuid, &gEfiDriverDiagnostics2ProtocolGuid, NULL};
//
// We need 1 more item on the list...
//
typedef enum {
/**
Do the diagnostics call for some set of handles.
@param[in] Mode The type of diagnostic test to run.
@param[in] Lang The language code to use.
@param[in] AllChilds Should the test be on all children.
@param[in] DriverHandle The driver handle to test with.
@param[in] ControllerHandle The specific controller handle to test.
@param[in] ChildHandle The specific child handle to test.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_INVALID_PARAMETER A parameter had an invalid value.
@retval EFI_NOT_FOUND No diagnostic handle could be found.
**/
)
{
return (EFI_INVALID_PARAMETER);
}
ChildHandleListCount = 0;
if (DriverHandle != NULL) {
DriverHandleList[0] = DriverHandle;
} else {
if (DriverHandleList == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"gEfiDriverDiagnosticsProtocolGuid", &gEfiDriverDiagnosticsProtocolGuid);
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"gEfiDriverDiagnostics2ProtocolGuid", &gEfiDriverDiagnostics2ProtocolGuid);
return (EFI_NOT_FOUND);
}
for (Walker = DriverHandleList ; Walker != NULL && *Walker != NULL ; DriverHandleListCount++, Walker++);
}
if (ControllerHandle != NULL) {
} else {
}
if (ChildHandle != NULL) {
ChildHandleList[0] = ChildHandle;
ChildHandleListCount = 1;
} else if (AllChilds) {
//
// This gets handled in the loop below.
//
} else {
}
if (Mode == TestModeList) {
}
for (DriverHandleListLoop = 0
){
if (Mode == TestModeList) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_HEADER), gShellDriver1HiiHandle, ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]));
}
if (ControllerHandle == NULL) {
PARSE_HANDLE_DATABASE_DEVICES(DriverHandleList[DriverHandleListLoop], &ControllerHandleListCount, &ControllerHandleList);
}
if (ControllerHandleListCount == 0) {
if (Mode == TestModeList) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_NO_HANDLES), gShellDriver1HiiHandle);
}
} else {
if (Mode == TestModeList) {
}
for (ControllerHandleListLoop = 0
){
if (AllChilds) {
}
for (ChildHandleListLoop = 0
){
if (Mode != TestModeList) {
//
// Get the protocol pointer and call the function
//
(VOID**)&DriverDiagnostics2,
NULL,
return (EFI_OUT_OF_RESOURCES);
}
}
} else {
return (EFI_OUT_OF_RESOURCES);
}
}
&OutBuffer);
}
}
(VOID**)&DriverDiagnostics,
NULL,
return (EFI_OUT_OF_RESOURCES);
}
}
} else {
return (EFI_OUT_OF_RESOURCES);
}
}
&OutBuffer);
}
}
}
-1,
-1,
NULL,
L"DrvDiag",
Status);
}
}
} else {
//
// Print out the information that this set can be tested
//
-1,
-1,
NULL,
);
}
//
// If we are doing a single pass with NULL child jump out after a single loop
//
if (ChildHandleList == NULL) {
break;
}
}
if (AllChilds) {
ChildHandleListCount = 0;
}
}
if (ControllerHandle == NULL) {
}
}
}
if (DriverHandleList != NULL) {
}
if (ControllerHandleList != NULL) {
}
if (ChildHandleList != NULL) {
}
return (Status2);
}
{L"-c", TypeFlag},
{L"-s", TypeFlag},
{L"-e", TypeFlag},
{L"-m", TypeFlag},
{L"-l", TypeValue},
};
/**
Function for 'drvdiag' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
)
{
Mode = TestModeMax;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
Status = CommandInit();
//
// parse the command line
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, ProblemParam);
} else {
}
} else {
//
// if more than 3 'value' parameters (plus the name one) or we have any 2 mode flags
//
){
//
// error for too many parameters
//
){
//
// Run the apropriate test
//
} else {
}
} else {
//
// Do a listing of what's available to test
//
Mode = TestModeList;
}
return (SHELL_INVALID_PARAMETER);
}
if (DriverHandleStr == NULL) {
} else {
}
if (ControllerHandleStr == NULL) {
} else {
}
if (ChildHandleStr == NULL) {
} else {
}
Status = DoDiagnostics (
Mode,
);
}
if (ShellStatus == SHELL_SUCCESS) {
if (Status == EFI_SECURITY_VIOLATION) {
} else if (Status == EFI_INVALID_PARAMETER) {
} else if (Status == EFI_NOT_FOUND) {
}
}
return (ShellStatus);
}