/** @file
Main file for devices 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"
/**
Get lots of info about a device from its handle.
@param[in] TheHandle The device handle to get info on.
@param[in, out] Type On successful return R, B, or D (root, bus, or
device) will be placed in this buffer.
@param[in, out] Cfg On successful return this buffer will be
TRUE if the handle has configuration, FALSE
otherwise.
@param[in, out] Diag On successful return this buffer will be
TRUE if the handle has disgnostics, FALSE
otherwise.
@param[in, out] Parents On successful return this buffer will be
contain the number of parent handles.
@param[in, out] Devices On successful return this buffer will be
contain the number of devices controlled.
@param[in, out] Children On successful return this buffer will be
contain the number of child handles.
@param[out] Name The pointer to a buffer that will be allocated
and contain the string name of the handle.
The caller must free this memory.
@param[in] Language The language code as defined by the UEFI spec.
@retval EFI_SUCCESS The info is there.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
**/
)
{
return (EFI_INVALID_PARAMETER);
}
*Children = 0;
*Parents = 0;
*Devices = 0;
*Type = L' ';
HandleBuffer = NULL;
gEfiShellProtocol->GetDeviceName(TheHandle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, Name);
// if (!EFI_ERROR(Status)) {
if (*Parents == 0) {
*Type = L'R';
} else if (*Children > 0) {
*Type = L'B';
} else {
*Type = L'D';
}
}
// }
if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
}
if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
}
if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
}
}
}
return (Status);
}
{L"-l", TypeValue},
};
/**
Function for 'devices' 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 {
//
// if more than 0 'value' parameters we have too many parameters
//
//
// error for too many parameters
//
} else {
//
// get the language if necessary
//
// Language = AllocateZeroPool(10);
// AsciiSPrint(Language, 10, "en-us");
} else {
return (SHELL_INVALID_PARAMETER);
}
//
// Print Header
//
//
// loop through each handle
//
for (HandleListWalker = HandleList
; HandleListWalker++
){
//
// get all the info on each handle
//
Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language);
-1,
-1,
Type,
}
}
}
if (HandleList != NULL) {
}
}
}
return (ShellStatus);
}