/** @file
Main file for Dh 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"
{L"-p", TypeValue},
{L"-d", TypeFlag},
{L"-v", TypeFlag},
{L"-verbose", TypeFlag},
{L"-sfo", TypeFlag},
{L"-l", TypeValue},
};
};
/**
Get the name of a driver by it's handle.
If a name is found the memory must be callee freed.
@param[in] TheHandle The driver's handle.
@param[in] Language The language to use.
@param[in] NameFound Upon a successful return the name found.
@retval EFI_SUCCESS The name was found.
**/
)
{
//
// Go through those handles until we get one that passes for GetComponentName
//
NULL,
NULL,
}
return (EFI_NOT_FOUND);
}
return (EFI_OUT_OF_RESOURCES);
}
}
} else {
return (EFI_OUT_OF_RESOURCES);
}
}
}
return (Status);
}
/**
Discover if a protocol guid is one of the UEFI Driver Model Protocols.
@param[in] Guid The guid to test.
@retval TRUE The guid does represent a driver model protocol.
@retval FALSE The guid does not represent a driver model protocol.
**/
)
{
; GuidWalker++
){
break;
}
}
return (GuidFound);
}
/**
Get information for a handle.
@param[in] TheHandle The handles to show info on.
@param[in] Language Language string per UEFI specification.
@param[in] Seperator Separator string between information blocks.
@param[in] Verbose TRUE for extra info, FALSE otherwise.
@param[in] ExtraInfo TRUE for extra info, FALSE otherwise.
@retval SHELL_SUCCESS The operation was successful.
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
**/
)
{
Size = 0;
);
if (Size != 0) {
}
}
if (ExtraInfo) {
if (!Verbose) {
} else {
}
}
}
}
}
return (NULL);
}
return (RetVal);
}
/**
Gets the name of the loaded image.
@param[in] TheHandle The handle of the driver to get info on.
@param[out] Name The pointer to the pointer. Valid upon a successful return.
@retval EFI_SUCCESS The operation was successful.
**/
)
{
// get loaded image and devicepathtotext on image->Filepath
return (EFI_INVALID_PARAMETER);
}
(VOID **) &LoadedImage,
NULL,
);
return (Status);
}
return (EFI_SUCCESS);
}
/**
Display driver model information for a given handle.
@param[in] Handle The handle to display info on.
@param[in] BestName Use the best name?
@param[in] Language The language to output in.
**/
)
{
//
// See if Handle is a device handle and display its details.
//
);
);
);
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
}
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfiguration2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
}
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
}
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
}
if (DriverBindingHandleCount > 0 || ParentControllerHandleCount > 0 || ChildControllerHandleCount > 0) {
DevicePath = NULL;
Status = gEfiShellProtocol->GetDeviceName(Handle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DRIVER1), gShellDriver1HiiHandle, TempStringPointer!=NULL?TempStringPointer:L"<Unknown>");
-1,
-1,
NULL,
);
if (DriverBindingHandleCount == 0) {
-1,
-1,
NULL,
L"<None>"
);
} else {
-1,
-1,
NULL,
L""
);
Status = GetDriverName (
);
if (DriverName == NULL) {
);
}
if (Image) {
-1,
-1,
NULL,
);
} else {
-1,
-1,
NULL,
);
}
}
}
if (ParentControllerHandleCount == 0) {
-1,
-1,
NULL,
L"<None>"
);
} else {
-1,
-1,
NULL,
L""
);
Status = gEfiShellProtocol->GetDeviceName(ParentControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
-1,
-1,
NULL,
);
}
}
if (ChildControllerHandleCount == 0) {
-1,
-1,
NULL,
L"<None>"
);
} else {
-1,
-1,
NULL,
L""
);
Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
-1,
-1,
NULL,
);
}
}
}
return Status;
}
//
// See if Handle is a driver binding handle and display its details.
//
(VOID **) &DriverBinding,
NULL,
NULL,
);
return EFI_SUCCESS;
}
NumberOfChildren = 0;
);
if (ControllerHandleCount > 0) {
);
}
}
-1,
-1,
NULL,
);
DriverName = NULL;
);
-1,
-1,
NULL,
);
-1,
-1,
NULL,
);
if (ControllerHandleCount == 0) {
-1,
-1,
NULL,
L"None"
);
} else {
-1,
-1,
NULL,
L""
);
Status = gEfiShellProtocol->GetDeviceName(ControllerHandleBuffer[HandleIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
-1,
-1,
NULL,
);
);
Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[ChildIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
-1,
-1,
NULL,
);
}
}
}
}
return EFI_SUCCESS;
}
/**
Display information for a handle.
@param[in] TheHandle The handles to show info on.
@param[in] Verbose TRUE for extra info, FALSE otherwise.
@param[in] Sfo TRUE to output in standard format output (spec).
@param[in] Language Language string per UEFI specification.
@param[in] DriverInfo TRUE to show all info about the handle.
@param[in] Multiple TRUE indicates more than will be output,
FALSE for a single one.
@retval SHELL_SUCCESS The operation was successful.
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
**/
)
{
if (!Sfo) {
if (Multiple) {
-1,
-1,
NULL,
} else {
-1,
-1,
NULL,
}
if (DriverInfo) {
}
} else {
-1,
-1,
NULL,
L"DriverName",
L"ControllerName",
L"DevPath",
}
if (ProtocolInfoString != NULL) {
}
return (ShellStatus);
}
/**
Display information for all handles on a list.
@param[in] HandleList The NULL-terminated list of handles.
@param[in] Sfo TRUE to output in standard format output (spec).
@param[in] Language Language string per UEFI specification.
@param[in] DriverInfo TRUE to show all info about the handle.
@retval SHELL_SUCCESS The operation was successful.
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
**/
)
{
for (HandleWalker = HandleList ; HandleWalker != NULL && *HandleWalker != NULL && ShellStatus == SHELL_SUCCESS; HandleWalker++) {
Sfo,
);
}
return (ShellStatus);
}
/**
Display information for all handles.
@param[in] Sfo TRUE to output in standard format output (spec).
@param[in] Language Language string per UEFI specification.
@param[in] DriverInfo TRUE to show all info about the handle.
@retval SHELL_SUCCESS The operation was successful.
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
**/
)
{
Sfo,
return (ShellStatus);
}
/**
Display information for all handles which have a specific protocol.
@param[in] ProtocolName The pointer to the name of the protocol.
@param[in] Sfo TRUE to output in standard format output (spec).
@param[in] Language Language string per UEFI specification.
@param[in] DriverInfo TRUE to show all info about the handle.
@retval SHELL_SUCCESS The operation was successful.
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
**/
)
{
if (ProtocolName == NULL) {
return (SHELL_INVALID_PARAMETER);
}
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DH_NO_GUID_FOUND), gShellDriver1HiiHandle, ProtocolName);
return (SHELL_INVALID_PARAMETER);
}
Sfo,
return (ShellStatus);
}
/**
Function for 'dh' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
)
{
//
// 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 {
return (SHELL_INVALID_PARAMETER);
}
} else {
return (SHELL_INVALID_PARAMETER);
}
Verbose = (BOOLEAN)(ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose"));
} else {
//
// print by protocol
//
);
}
} else {
//
// Print everything
//
);
} else {
} else {
//
// print 1 handle
//
);
}
}
}
}
return (ShellStatus);
}