2010-11-12 20:40:21 +01:00
|
|
|
/** @file
|
|
|
|
Main file for Dh shell Driver1 function.
|
|
|
|
|
2015-02-04 23:25:01 +01:00
|
|
|
(C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.<BR>
|
2017-01-09 09:45:40 +01:00
|
|
|
Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
|
2017-06-27 20:17:24 +02:00
|
|
|
(C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
|
2010-11-12 20:40:21 +01:00
|
|
|
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
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
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 SHELL_PARAM_ITEM ParamList[] = {
|
|
|
|
{L"-p", TypeValue},
|
|
|
|
{L"-d", TypeFlag},
|
|
|
|
{L"-v", TypeFlag},
|
|
|
|
{L"-verbose", TypeFlag},
|
|
|
|
{L"-sfo", TypeFlag},
|
|
|
|
{L"-l", TypeValue},
|
|
|
|
{NULL, TypeMax}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATIC CONST EFI_GUID *UefiDriverModelProtocolsGuidArray[] = {
|
|
|
|
&gEfiDriverBindingProtocolGuid,
|
|
|
|
&gEfiPlatformDriverOverrideProtocolGuid,
|
|
|
|
&gEfiBusSpecificDriverOverrideProtocolGuid,
|
|
|
|
&gEfiDriverDiagnosticsProtocolGuid,
|
|
|
|
&gEfiDriverDiagnostics2ProtocolGuid,
|
|
|
|
&gEfiComponentNameProtocolGuid,
|
|
|
|
&gEfiComponentName2ProtocolGuid,
|
|
|
|
&gEfiPlatformToDriverConfigurationProtocolGuid,
|
|
|
|
&gEfiDriverSupportedEfiVersionProtocolGuid,
|
|
|
|
&gEfiDriverFamilyOverrideProtocolGuid,
|
|
|
|
&gEfiDriverHealthProtocolGuid,
|
|
|
|
&gEfiLoadedImageProtocolGuid,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
UINTN mGuidDataLen[] = {8, 4, 4, 4, 12};
|
|
|
|
/**
|
|
|
|
Function to determine if the string can convert to a GUID.
|
|
|
|
The string must be restricted as "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" format.
|
|
|
|
|
|
|
|
@param[in] String The string to test.
|
|
|
|
|
|
|
|
@retval TRUE The string can convert to a GUID.
|
|
|
|
@retval FALSE The string can't convert to a GUID.
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
IsValidGuidString(
|
|
|
|
IN CONST CHAR16 *String
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CONST CHAR16 *Walker;
|
|
|
|
CONST CHAR16 *PrevWalker;
|
|
|
|
UINTN Index;
|
|
|
|
|
|
|
|
if (String == NULL) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Walker = String;
|
|
|
|
PrevWalker = String;
|
|
|
|
Index = 0;
|
|
|
|
|
|
|
|
while (Walker != NULL && *Walker != CHAR_NULL) {
|
|
|
|
if ( (*Walker >= '0' && *Walker <= '9') ||
|
|
|
|
(*Walker >= 'a' && *Walker <= 'f') ||
|
|
|
|
(*Walker >= 'A' && *Walker <= 'F')
|
|
|
|
) {
|
|
|
|
Walker++;
|
|
|
|
} else {
|
ShellPkg: Refine type cast for pointer subtraction
For pointer subtraction, the result is of type "ptrdiff_t". According to
the C11 standard (Committee Draft - April 12, 2011):
"When two pointers are subtracted, both shall point to elements of the
same array object, or one past the last element of the array object; the
result is the difference of the subscripts of the two array elements. The
size of the result is implementation-defined, and its type (a signed
integer type) is ptrdiff_t defined in the <stddef.h> header. If the result
is not representable in an object of that type, the behavior is
undefined."
In our codes, there are cases that the pointer subtraction is not
performed by pointers to elements of the same array object. This might
lead to potential issues, since the behavior is undefined according to C11
standard.
Also, since the size of type "ptrdiff_t" is implementation-defined. Some
static code checkers may warn that the pointer subtraction might underflow
first and then being cast to a bigger size. For example:
UINT8 *Ptr1, *Ptr2;
UINTN PtrDiff;
...
PtrDiff = (UINTN) (Ptr1 - Ptr2);
The commit will refine the pointer subtraction expressions by casting each
pointer to UINTN first and then perform the subtraction:
PtrDiff = (UINTN) Ptr1 - (UINTN) Ptr2;
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-01-23 07:38:43 +01:00
|
|
|
if (*Walker == L'-' && (((UINTN)Walker - (UINTN)PrevWalker) / sizeof (CHAR16)) == mGuidDataLen[Index]) {
|
2017-01-09 03:51:58 +01:00
|
|
|
Walker++;
|
|
|
|
PrevWalker = Walker;
|
|
|
|
Index++;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ShellPkg: Refine type cast for pointer subtraction
For pointer subtraction, the result is of type "ptrdiff_t". According to
the C11 standard (Committee Draft - April 12, 2011):
"When two pointers are subtracted, both shall point to elements of the
same array object, or one past the last element of the array object; the
result is the difference of the subscripts of the two array elements. The
size of the result is implementation-defined, and its type (a signed
integer type) is ptrdiff_t defined in the <stddef.h> header. If the result
is not representable in an object of that type, the behavior is
undefined."
In our codes, there are cases that the pointer subtraction is not
performed by pointers to elements of the same array object. This might
lead to potential issues, since the behavior is undefined according to C11
standard.
Also, since the size of type "ptrdiff_t" is implementation-defined. Some
static code checkers may warn that the pointer subtraction might underflow
first and then being cast to a bigger size. For example:
UINT8 *Ptr1, *Ptr2;
UINTN PtrDiff;
...
PtrDiff = (UINTN) (Ptr1 - Ptr2);
The commit will refine the pointer subtraction expressions by casting each
pointer to UINTN first and then perform the subtraction:
PtrDiff = (UINTN) Ptr1 - (UINTN) Ptr2;
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-01-23 07:38:43 +01:00
|
|
|
if ((((UINTN)Walker - (UINTN)PrevWalker) / sizeof (CHAR16)) == mGuidDataLen[Index]) {
|
2017-01-09 03:51:58 +01:00
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Convert a hex-character to decimal value.
|
|
|
|
|
|
|
|
This internal function only deal with Unicode character
|
|
|
|
which maps to a valid hexadecimal ASII character, i.e.
|
|
|
|
L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other
|
|
|
|
Unicode character, the value returned does not make sense.
|
|
|
|
|
|
|
|
@param[in] Char The character to convert.
|
|
|
|
|
|
|
|
@retval The numerical value converted.
|
|
|
|
**/
|
|
|
|
UINTN
|
|
|
|
HexCharToDecimal(
|
|
|
|
IN CHAR16 Char
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (Char >= '0' && Char <= '9') {
|
|
|
|
return Char - L'0';
|
|
|
|
} else if (Char >= 'a' && Char <= 'f') {
|
|
|
|
return Char - L'a' + 10;
|
|
|
|
} else {
|
|
|
|
return Char - L'A' + 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function try to convert a string to GUID format.
|
|
|
|
|
|
|
|
@param[in] String The string will be converted.
|
|
|
|
@param[out] Guid Save the result convert from string.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The string was successfully converted to a GUID.
|
|
|
|
@retval EFI_UNSUPPORTED The input string is not in registry format.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
ConvertStrToGuid(
|
|
|
|
IN CONST CHAR16 *String,
|
|
|
|
OUT GUID *Guid
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CONST CHAR16 *Walker;
|
|
|
|
UINT8 TempValue;
|
|
|
|
UINTN Index;
|
|
|
|
|
|
|
|
if (String == NULL || !IsValidGuidString (String)) {
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
Index = 0;
|
|
|
|
|
|
|
|
Walker = String;
|
|
|
|
Guid->Data1 = (UINT32)StrHexToUint64 (Walker);
|
|
|
|
|
|
|
|
Walker += 9;
|
|
|
|
Guid->Data2 = (UINT16)StrHexToUint64 (Walker);
|
|
|
|
|
|
|
|
Walker += 5;
|
|
|
|
Guid->Data3 = (UINT16)StrHexToUint64 (Walker);
|
|
|
|
|
|
|
|
Walker += 5;
|
|
|
|
while (Walker != NULL && *Walker != CHAR_NULL) {
|
|
|
|
if (*Walker == L'-') {
|
|
|
|
Walker++;
|
|
|
|
} else {
|
|
|
|
TempValue = (UINT8)HexCharToDecimal (*Walker);
|
|
|
|
TempValue = (UINT8)LShiftU64 (TempValue, 4);
|
|
|
|
Walker++;
|
|
|
|
|
|
|
|
TempValue += (UINT8)HexCharToDecimal (*Walker);
|
|
|
|
Walker++;
|
|
|
|
|
|
|
|
Guid->Data4[Index] = TempValue;
|
|
|
|
Index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
/**
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
GetDriverName (
|
|
|
|
IN EFI_HANDLE TheHandle,
|
|
|
|
IN CONST CHAR8 *Language,
|
|
|
|
IN CHAR16 **NameFound
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CHAR8 *Lang;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_COMPONENT_NAME2_PROTOCOL *CompName2;
|
|
|
|
CHAR16 *NameToReturn;
|
|
|
|
//
|
|
|
|
// Go through those handles until we get one that passes for GetComponentName
|
|
|
|
//
|
|
|
|
Status = gBS->OpenProtocol(
|
|
|
|
TheHandle,
|
|
|
|
&gEfiComponentName2ProtocolGuid,
|
|
|
|
(VOID**)&CompName2,
|
|
|
|
gImageHandle,
|
|
|
|
NULL,
|
|
|
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
|
|
|
if (EFI_ERROR(Status)) {
|
|
|
|
Status = gBS->OpenProtocol(
|
|
|
|
TheHandle,
|
|
|
|
&gEfiComponentNameProtocolGuid,
|
|
|
|
(VOID**)&CompName2,
|
|
|
|
gImageHandle,
|
|
|
|
NULL,
|
|
|
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (EFI_ERROR(Status)) {
|
|
|
|
return (EFI_NOT_FOUND);
|
|
|
|
}
|
2013-09-05 05:02:14 +02:00
|
|
|
Lang = GetBestLanguageForDriver (CompName2->SupportedLanguages, Language, FALSE);
|
2011-03-25 22:13:43 +01:00
|
|
|
Status = CompName2->GetDriverName(CompName2, Lang, &NameToReturn);
|
|
|
|
FreePool(Lang);
|
|
|
|
|
|
|
|
if (!EFI_ERROR(Status) && NameToReturn != NULL) {
|
|
|
|
*NameFound = NULL;
|
|
|
|
StrnCatGrow(NameFound, NULL, NameToReturn, 0);
|
|
|
|
}
|
|
|
|
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.
|
|
|
|
**/
|
2010-11-12 20:40:21 +01:00
|
|
|
BOOLEAN
|
|
|
|
IsDriverProt (
|
|
|
|
IN CONST EFI_GUID *Guid
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CONST EFI_GUID **GuidWalker;
|
|
|
|
BOOLEAN GuidFound;
|
|
|
|
GuidFound = FALSE;
|
|
|
|
for (GuidWalker = UefiDriverModelProtocolsGuidArray
|
|
|
|
; GuidWalker != NULL && *GuidWalker != NULL
|
|
|
|
; GuidWalker++
|
|
|
|
){
|
|
|
|
if (CompareGuid(*GuidWalker, Guid)) {
|
|
|
|
GuidFound = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (GuidFound);
|
|
|
|
}
|
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
/**
|
|
|
|
Get information for a handle.
|
|
|
|
|
|
|
|
@param[in] TheHandle The handles to show info on.
|
|
|
|
@param[in] Language Language string per UEFI specification.
|
2016-10-19 09:01:35 +02:00
|
|
|
@param[in] Separator Separator string between information blocks.
|
2011-03-25 22:13:43 +01:00
|
|
|
@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.
|
|
|
|
**/
|
2010-11-12 20:40:21 +01:00
|
|
|
CHAR16*
|
|
|
|
GetProtocolInfoString(
|
|
|
|
IN CONST EFI_HANDLE TheHandle,
|
|
|
|
IN CONST CHAR8 *Language,
|
2016-10-19 09:01:35 +02:00
|
|
|
IN CONST CHAR16 *Separator,
|
2010-11-12 20:40:21 +01:00
|
|
|
IN CONST BOOLEAN Verbose,
|
|
|
|
IN CONST BOOLEAN ExtraInfo
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_GUID **ProtocolGuidArray;
|
|
|
|
UINTN ArrayCount;
|
|
|
|
UINTN ProtocolIndex;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
CHAR16 *RetVal;
|
|
|
|
UINTN Size;
|
|
|
|
CHAR16 *Temp;
|
2017-01-09 09:45:40 +01:00
|
|
|
CHAR16 GuidStr[40];
|
2017-09-28 04:25:23 +02:00
|
|
|
VOID *Instance;
|
2017-09-21 07:26:59 +02:00
|
|
|
CHAR16 InstanceStr[17];
|
2010-11-12 20:40:21 +01:00
|
|
|
|
|
|
|
ProtocolGuidArray = NULL;
|
2011-03-25 22:13:43 +01:00
|
|
|
RetVal = NULL;
|
|
|
|
Size = 0;
|
2010-11-12 20:40:21 +01:00
|
|
|
|
|
|
|
Status = gBS->ProtocolsPerHandle (
|
|
|
|
TheHandle,
|
|
|
|
&ProtocolGuidArray,
|
|
|
|
&ArrayCount
|
|
|
|
);
|
|
|
|
if (!EFI_ERROR (Status)) {
|
|
|
|
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
|
|
|
|
Temp = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], Language);
|
2017-01-09 09:45:40 +01:00
|
|
|
ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
|
|
|
|
if (Size != 0) {
|
|
|
|
StrnCatGrow(&RetVal, &Size, Separator, 0);
|
|
|
|
}
|
|
|
|
StrnCatGrow(&RetVal, &Size, L"%H", 0);
|
|
|
|
if (Temp == NULL) {
|
|
|
|
UnicodeSPrint (GuidStr, sizeof (GuidStr), L"%g", ProtocolGuidArray[ProtocolIndex]);
|
|
|
|
StrnCatGrow (&RetVal, &Size, GuidStr, 0);
|
|
|
|
} else {
|
2010-11-12 20:40:21 +01:00
|
|
|
StrnCatGrow(&RetVal, &Size, Temp, 0);
|
|
|
|
FreePool(Temp);
|
|
|
|
}
|
2017-01-09 09:45:40 +01:00
|
|
|
StrnCatGrow(&RetVal, &Size, L"%N", 0);
|
2017-09-21 07:26:59 +02:00
|
|
|
|
|
|
|
if(Verbose) {
|
2017-09-28 04:25:23 +02:00
|
|
|
Status = gBS->HandleProtocol (TheHandle, ProtocolGuidArray[ProtocolIndex], &Instance);
|
2017-09-21 07:26:59 +02:00
|
|
|
if (!EFI_ERROR (Status)) {
|
|
|
|
StrnCatGrow (&RetVal, &Size, L"(%H", 0);
|
2017-09-28 04:25:23 +02:00
|
|
|
UnicodeSPrint (InstanceStr, sizeof (InstanceStr), L"%x", Instance);
|
2017-09-21 07:26:59 +02:00
|
|
|
StrnCatGrow (&RetVal, &Size, InstanceStr, 0);
|
|
|
|
StrnCatGrow (&RetVal, &Size, L"%N)", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-12 20:40:21 +01:00
|
|
|
if (ExtraInfo) {
|
|
|
|
Temp = GetProtocolInformationDump(TheHandle, ProtocolGuidArray[ProtocolIndex], Verbose);
|
|
|
|
if (Temp != NULL) {
|
|
|
|
ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
|
|
|
|
if (!Verbose) {
|
|
|
|
StrnCatGrow(&RetVal, &Size, L"(", 0);
|
|
|
|
StrnCatGrow(&RetVal, &Size, Temp, 0);
|
2017-09-21 05:14:17 +02:00
|
|
|
StrnCatGrow(&RetVal, &Size, L")", 0);
|
2010-11-12 20:40:21 +01:00
|
|
|
} else {
|
2016-10-19 09:01:35 +02:00
|
|
|
StrnCatGrow(&RetVal, &Size, Separator, 0);
|
2010-11-12 20:40:21 +01:00
|
|
|
StrnCatGrow(&RetVal, &Size, Temp, 0);
|
|
|
|
}
|
|
|
|
FreePool(Temp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-03-25 22:13:43 +01:00
|
|
|
|
|
|
|
SHELL_FREE_NON_NULL(ProtocolGuidArray);
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
if (RetVal == NULL) {
|
|
|
|
return (NULL);
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
2011-03-25 22:13:43 +01:00
|
|
|
|
2010-11-12 20:40:21 +01:00
|
|
|
ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
|
2016-10-19 09:01:35 +02:00
|
|
|
StrnCatGrow(&RetVal, &Size, Separator, 0);
|
2010-11-12 20:40:21 +01:00
|
|
|
return (RetVal);
|
|
|
|
}
|
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
/**
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
GetDriverImageName (
|
|
|
|
IN EFI_HANDLE TheHandle,
|
|
|
|
OUT CHAR16 **Name
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// get loaded image and devicepathtotext on image->Filepath
|
|
|
|
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
|
|
|
|
if (TheHandle == NULL || Name == NULL) {
|
|
|
|
return (EFI_INVALID_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = gBS->OpenProtocol (
|
|
|
|
TheHandle,
|
|
|
|
&gEfiLoadedImageProtocolGuid,
|
|
|
|
(VOID **) &LoadedImage,
|
|
|
|
gImageHandle,
|
|
|
|
NULL,
|
|
|
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
|
|
|
);
|
|
|
|
if (EFI_ERROR(Status)) {
|
|
|
|
return (Status);
|
|
|
|
}
|
|
|
|
DevicePath = LoadedImage->FilePath;
|
2013-07-26 05:14:08 +02:00
|
|
|
*Name = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
|
2011-03-25 22:13:43 +01:00
|
|
|
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.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
DisplayDriverModelHandle (
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN BOOLEAN BestName,
|
|
|
|
IN CONST CHAR8 *Language OPTIONAL
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
BOOLEAN ConfigurationStatus;
|
|
|
|
BOOLEAN DiagnosticsStatus;
|
|
|
|
UINTN DriverBindingHandleCount;
|
|
|
|
EFI_HANDLE *DriverBindingHandleBuffer;
|
|
|
|
UINTN ParentControllerHandleCount;
|
|
|
|
EFI_HANDLE *ParentControllerHandleBuffer;
|
|
|
|
UINTN ChildControllerHandleCount;
|
|
|
|
EFI_HANDLE *ChildControllerHandleBuffer;
|
|
|
|
CHAR16 *TempStringPointer;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
UINTN Index;
|
|
|
|
CHAR16 *DriverName;
|
|
|
|
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
|
|
|
|
UINTN NumberOfChildren;
|
|
|
|
UINTN HandleIndex;
|
|
|
|
UINTN ControllerHandleCount;
|
|
|
|
EFI_HANDLE *ControllerHandleBuffer;
|
|
|
|
UINTN ChildIndex;
|
|
|
|
BOOLEAN Image;
|
|
|
|
|
2014-07-29 04:00:55 +02:00
|
|
|
DriverName = NULL;
|
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
//
|
|
|
|
// See if Handle is a device handle and display its details.
|
|
|
|
//
|
|
|
|
DriverBindingHandleBuffer = NULL;
|
|
|
|
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
|
|
|
|
Handle,
|
|
|
|
&DriverBindingHandleCount,
|
|
|
|
&DriverBindingHandleBuffer
|
|
|
|
);
|
|
|
|
|
|
|
|
ParentControllerHandleBuffer = NULL;
|
|
|
|
Status = PARSE_HANDLE_DATABASE_PARENTS (
|
|
|
|
Handle,
|
|
|
|
&ParentControllerHandleCount,
|
|
|
|
&ParentControllerHandleBuffer
|
|
|
|
);
|
|
|
|
|
|
|
|
ChildControllerHandleBuffer = NULL;
|
|
|
|
Status = ParseHandleDatabaseForChildControllers (
|
|
|
|
Handle,
|
|
|
|
&ChildControllerHandleCount,
|
|
|
|
&ChildControllerHandleBuffer
|
|
|
|
);
|
|
|
|
|
|
|
|
DiagnosticsStatus = FALSE;
|
|
|
|
ConfigurationStatus = FALSE;
|
|
|
|
|
|
|
|
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
|
|
|
ConfigurationStatus = TRUE;
|
|
|
|
}
|
|
|
|
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfiguration2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
|
|
|
ConfigurationStatus = TRUE;
|
|
|
|
}
|
|
|
|
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
|
|
|
DiagnosticsStatus = TRUE;
|
|
|
|
}
|
|
|
|
if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
|
|
|
|
DiagnosticsStatus = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = EFI_SUCCESS;
|
|
|
|
|
|
|
|
if (DriverBindingHandleCount > 0 || ParentControllerHandleCount > 0 || ChildControllerHandleCount > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DevicePath = NULL;
|
|
|
|
TempStringPointer = NULL;
|
|
|
|
Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID**)&DevicePath);
|
|
|
|
|
|
|
|
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>");
|
|
|
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
|
|
|
|
2013-07-26 05:14:08 +02:00
|
|
|
TempStringPointer = ConvertDevicePathToText(DevicePath, TRUE, FALSE);
|
2011-03-25 22:13:43 +01:00
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER2),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
TempStringPointer!=NULL?TempStringPointer:L"<None>",
|
|
|
|
ParentControllerHandleCount == 0?L"ROOT":(ChildControllerHandleCount > 0)?L"BUS":L"DEVICE",
|
|
|
|
ConfigurationStatus?L"YES":L"NO",
|
|
|
|
DiagnosticsStatus?L"YES":L"NO"
|
|
|
|
);
|
|
|
|
|
|
|
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
|
|
|
|
|
|
|
if (DriverBindingHandleCount == 0) {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER3),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
L"<None>"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER3),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
L""
|
|
|
|
);
|
|
|
|
for (Index = 0; Index < DriverBindingHandleCount; Index++) {
|
|
|
|
Image = FALSE;
|
|
|
|
Status = GetDriverName (
|
|
|
|
DriverBindingHandleBuffer[Index],
|
|
|
|
Language,
|
|
|
|
&DriverName
|
|
|
|
);
|
2012-10-06 00:26:25 +02:00
|
|
|
if (EFI_ERROR (Status)) {
|
2011-03-25 22:13:43 +01:00
|
|
|
Status = GetDriverImageName (
|
|
|
|
DriverBindingHandleBuffer[Index],
|
|
|
|
&DriverName
|
|
|
|
);
|
2012-10-06 00:26:25 +02:00
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
DriverName = NULL;
|
|
|
|
}
|
2011-03-25 22:13:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Image) {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER4A),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex (DriverBindingHandleBuffer[Index]),
|
|
|
|
DriverName!=NULL?DriverName:L"<Unknown>"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER4B),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex (DriverBindingHandleBuffer[Index]),
|
|
|
|
DriverName!=NULL?DriverName:L"<Unknown>"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
SHELL_FREE_NON_NULL(DriverName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ParentControllerHandleCount == 0) {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER5),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
L"<None>"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER5),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
L""
|
|
|
|
);
|
|
|
|
for (Index = 0; Index < ParentControllerHandleCount; Index++) {
|
|
|
|
Status = gEfiShellProtocol->GetDeviceName(ParentControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER5B),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex (ParentControllerHandleBuffer[Index]),
|
|
|
|
TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
|
|
|
|
);
|
|
|
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ChildControllerHandleCount == 0) {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
L"<None>"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
L""
|
|
|
|
);
|
|
|
|
for (Index = 0; Index < ChildControllerHandleCount; Index++) {
|
|
|
|
Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6B),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex (ChildControllerHandleBuffer[Index]),
|
|
|
|
TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
|
|
|
|
);
|
|
|
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SHELL_FREE_NON_NULL(DriverBindingHandleBuffer);
|
|
|
|
|
|
|
|
SHELL_FREE_NON_NULL(ParentControllerHandleBuffer);
|
|
|
|
|
|
|
|
SHELL_FREE_NON_NULL(ChildControllerHandleBuffer);
|
|
|
|
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// See if Handle is a driver binding handle and display its details.
|
|
|
|
//
|
|
|
|
Status = gBS->OpenProtocol (
|
|
|
|
Handle,
|
|
|
|
&gEfiDriverBindingProtocolGuid,
|
|
|
|
(VOID **) &DriverBinding,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
|
|
|
);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NumberOfChildren = 0;
|
|
|
|
ControllerHandleBuffer = NULL;
|
|
|
|
Status = PARSE_HANDLE_DATABASE_DEVICES (
|
|
|
|
Handle,
|
|
|
|
&ControllerHandleCount,
|
|
|
|
&ControllerHandleBuffer
|
|
|
|
);
|
|
|
|
if (ControllerHandleCount > 0) {
|
|
|
|
for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) {
|
|
|
|
Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
|
|
|
|
Handle,
|
|
|
|
ControllerHandleBuffer[HandleIndex],
|
|
|
|
&ChildControllerHandleCount,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
NumberOfChildren += ChildControllerHandleCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = GetDriverName (Handle, Language, &DriverName);
|
2012-10-06 00:26:25 +02:00
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
DriverName = NULL;
|
|
|
|
}
|
2011-03-25 22:13:43 +01:00
|
|
|
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
2017-06-27 20:17:24 +02:00
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER7),
|
2011-03-25 22:13:43 +01:00
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex(Handle),
|
|
|
|
DriverName!=NULL?DriverName:L"<Unknown>"
|
|
|
|
);
|
|
|
|
SHELL_FREE_NON_NULL(DriverName);
|
|
|
|
Status = GetDriverImageName (
|
|
|
|
Handle,
|
|
|
|
&DriverName
|
|
|
|
);
|
2012-10-06 00:26:25 +02:00
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
DriverName = NULL;
|
|
|
|
}
|
2011-03-25 22:13:43 +01:00
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER7B),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
DriverName!=NULL?DriverName:L"<Unknown>"
|
|
|
|
);
|
|
|
|
SHELL_FREE_NON_NULL(DriverName);
|
|
|
|
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER8),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
DriverBinding->Version,
|
|
|
|
NumberOfChildren > 0?L"Bus":ControllerHandleCount > 0?L"Device":L"<Unknown>",
|
|
|
|
ConfigurationStatus?L"YES":L"NO",
|
|
|
|
DiagnosticsStatus?L"YES":L"NO"
|
|
|
|
);
|
|
|
|
|
|
|
|
if (ControllerHandleCount == 0) {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
2017-09-21 05:45:04 +02:00
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER9),
|
2011-03-25 22:13:43 +01:00
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
L"None"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
2017-09-21 05:45:04 +02:00
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER9),
|
2011-03-25 22:13:43 +01:00
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
L""
|
|
|
|
);
|
|
|
|
for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) {
|
|
|
|
Status = gEfiShellProtocol->GetDeviceName(ControllerHandleBuffer[HandleIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
|
|
|
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER9B),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex(ControllerHandleBuffer[HandleIndex]),
|
|
|
|
TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
|
|
|
|
);
|
|
|
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
|
|
|
|
|
|
|
Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
|
|
|
|
Handle,
|
|
|
|
ControllerHandleBuffer[HandleIndex],
|
|
|
|
&ChildControllerHandleCount,
|
|
|
|
&ChildControllerHandleBuffer
|
|
|
|
);
|
|
|
|
if (!EFI_ERROR (Status)) {
|
|
|
|
for (ChildIndex = 0; ChildIndex < ChildControllerHandleCount; ChildIndex++) {
|
|
|
|
Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[ChildIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
|
|
|
|
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
2017-09-21 05:45:04 +02:00
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6C),
|
2011-03-25 22:13:43 +01:00
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex(ChildControllerHandleBuffer[ChildIndex]),
|
|
|
|
TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
|
|
|
|
);
|
|
|
|
SHELL_FREE_NON_NULL(TempStringPointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
SHELL_FREE_NON_NULL (ChildControllerHandleBuffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SHELL_FREE_NON_NULL (ControllerHandleBuffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
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.
|
|
|
|
**/
|
2017-01-05 06:29:50 +01:00
|
|
|
VOID
|
2010-11-12 20:40:21 +01:00
|
|
|
DoDhByHandle(
|
|
|
|
IN CONST EFI_HANDLE TheHandle,
|
|
|
|
IN CONST BOOLEAN Verbose,
|
|
|
|
IN CONST BOOLEAN Sfo,
|
|
|
|
IN CONST CHAR8 *Language,
|
|
|
|
IN CONST BOOLEAN DriverInfo,
|
|
|
|
IN CONST BOOLEAN Multiple
|
|
|
|
)
|
|
|
|
{
|
2017-01-05 06:29:50 +01:00
|
|
|
CHAR16 *ProtocolInfoString;
|
2010-11-12 20:40:21 +01:00
|
|
|
|
|
|
|
ProtocolInfoString = NULL;
|
|
|
|
|
|
|
|
if (!Sfo) {
|
|
|
|
if (Multiple) {
|
2011-03-25 22:13:43 +01:00
|
|
|
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L" ", Verbose, TRUE);
|
2010-11-12 20:40:21 +01:00
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex(TheHandle),
|
2017-01-05 06:29:50 +01:00
|
|
|
ProtocolInfoString==NULL?L"":ProtocolInfoString
|
|
|
|
);
|
2010-11-12 20:40:21 +01:00
|
|
|
} else {
|
2017-09-21 05:14:17 +02:00
|
|
|
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, Verbose ? L"\r\n" : L" ", Verbose, TRUE);
|
|
|
|
if (Verbose) {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_SINGLE),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex(TheHandle),
|
|
|
|
TheHandle,
|
|
|
|
ProtocolInfoString==NULL?L"":ProtocolInfoString
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_SINGLE_D),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
ConvertHandleToHandleIndex(TheHandle),
|
|
|
|
ProtocolInfoString==NULL?L"":ProtocolInfoString
|
|
|
|
);
|
|
|
|
}
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
2011-03-25 22:13:43 +01:00
|
|
|
|
|
|
|
if (DriverInfo) {
|
|
|
|
DisplayDriverModelHandle ((EFI_HANDLE)TheHandle, TRUE, Language);
|
|
|
|
}
|
2010-11-12 20:40:21 +01:00
|
|
|
} else {
|
2011-03-25 22:13:43 +01:00
|
|
|
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L";", FALSE, FALSE);
|
2010-11-12 20:40:21 +01:00
|
|
|
ShellPrintHiiEx(
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
NULL,
|
|
|
|
STRING_TOKEN (STR_DH_OUTPUT_SFO),
|
|
|
|
gShellDriver1HiiHandle,
|
|
|
|
Multiple ?L"HandlesInfo":L"HandleInfo",
|
|
|
|
L"DriverName",
|
|
|
|
L"ControllerName",
|
|
|
|
ConvertHandleToHandleIndex(TheHandle),
|
|
|
|
L"DevPath",
|
2017-01-05 06:29:50 +01:00
|
|
|
ProtocolInfoString==NULL?L"":ProtocolInfoString
|
|
|
|
);
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ProtocolInfoString != NULL) {
|
|
|
|
FreePool(ProtocolInfoString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
/**
|
|
|
|
Display information for all handles on a list.
|
|
|
|
|
|
|
|
@param[in] HandleList The NULL-terminated list of handles.
|
2012-01-10 21:53:26 +01:00
|
|
|
@param[in] Verbose TRUE for extra info, FALSE otherwise.
|
2011-03-25 22:13:43 +01:00
|
|
|
@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.
|
|
|
|
|
2017-01-05 06:29:50 +01:00
|
|
|
@retval SHELL_SUCCESS The operation was successful.
|
|
|
|
@retval SHELL_ABORTED The operation was aborted.
|
2011-03-25 22:13:43 +01:00
|
|
|
**/
|
2010-11-12 20:40:21 +01:00
|
|
|
SHELL_STATUS
|
|
|
|
DoDhForHandleList(
|
|
|
|
IN CONST EFI_HANDLE *HandleList,
|
2012-01-10 21:53:26 +01:00
|
|
|
IN CONST BOOLEAN Verbose,
|
2010-11-12 20:40:21 +01:00
|
|
|
IN CONST BOOLEAN Sfo,
|
|
|
|
IN CONST CHAR8 *Language,
|
|
|
|
IN CONST BOOLEAN DriverInfo
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CONST EFI_HANDLE *HandleWalker;
|
|
|
|
SHELL_STATUS ShellStatus;
|
|
|
|
|
|
|
|
ShellStatus = SHELL_SUCCESS;
|
2017-01-09 03:51:58 +01:00
|
|
|
for (HandleWalker = HandleList; HandleWalker != NULL && *HandleWalker != NULL; HandleWalker++) {
|
2017-01-05 06:29:50 +01:00
|
|
|
DoDhByHandle (*HandleWalker, Verbose, Sfo, Language, DriverInfo, TRUE);
|
2014-08-29 22:37:32 +02:00
|
|
|
if (ShellGetExecutionBreakFlag ()) {
|
|
|
|
ShellStatus = SHELL_ABORTED;
|
|
|
|
break;
|
|
|
|
}
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
|
|
|
return (ShellStatus);
|
|
|
|
}
|
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
/**
|
2017-01-09 03:51:58 +01:00
|
|
|
Display information for a GUID of protocol.
|
2011-03-25 22:13:43 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
@param[in] Guid The pointer to the name of the protocol.
|
2012-01-10 21:53:26 +01:00
|
|
|
@param[in] Verbose TRUE for extra info, FALSE otherwise.
|
2017-01-09 03:51:58 +01:00
|
|
|
@param[in] Sfo TRUE to output in standard format output (spec).
|
2011-03-25 22:13:43 +01:00
|
|
|
@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.
|
2017-01-09 03:51:58 +01:00
|
|
|
@retval SHELL_NOT_FOUND The GUID was not found.
|
2011-03-25 22:13:43 +01:00
|
|
|
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
|
|
|
|
**/
|
2010-11-12 20:40:21 +01:00
|
|
|
SHELL_STATUS
|
2017-01-09 03:51:58 +01:00
|
|
|
DoDhByProtocolGuid(
|
|
|
|
IN CONST GUID *Guid,
|
2012-01-10 21:53:26 +01:00
|
|
|
IN CONST BOOLEAN Verbose,
|
2017-01-09 03:51:58 +01:00
|
|
|
IN CONST BOOLEAN Sfo,
|
2010-11-12 20:40:21 +01:00
|
|
|
IN CONST CHAR8 *Language,
|
|
|
|
IN CONST BOOLEAN DriverInfo
|
|
|
|
)
|
|
|
|
{
|
2017-01-09 03:51:58 +01:00
|
|
|
CHAR16 *Name;
|
2010-11-12 20:40:21 +01:00
|
|
|
SHELL_STATUS ShellStatus;
|
2017-01-09 03:51:58 +01:00
|
|
|
EFI_HANDLE *HandleList;
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
if (!Sfo) {
|
|
|
|
if (Guid == NULL) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_ALL_HEADER), gShellDriver1HiiHandle);
|
|
|
|
} else {
|
|
|
|
Name = GetStringNameFromGuid (Guid, NULL);
|
|
|
|
if (Name == NULL) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_GUID_HEADER), gShellDriver1HiiHandle, Guid);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_NAME_HEADER), gShellDriver1HiiHandle, Name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HandleList = GetHandleListByProtocol(Guid);
|
|
|
|
ShellStatus = DoDhForHandleList(HandleList, Verbose, Sfo, Language, DriverInfo);
|
|
|
|
SHELL_FREE_NON_NULL(HandleList);
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
return ShellStatus;
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
/**
|
2017-01-09 03:51:58 +01:00
|
|
|
Function to determine use which method to print information.
|
|
|
|
If Protocol is NULL, The function will print all information.
|
2011-03-25 22:13:43 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
@param[in] Protocol The pointer to the name or GUID of protocol or NULL.
|
2012-01-10 21:53:26 +01:00
|
|
|
@param[in] Verbose TRUE for extra info, FALSE otherwise.
|
2011-03-25 22:13:43 +01:00
|
|
|
@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.
|
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
@retval SHELL_SUCCESS The operation was successful.
|
|
|
|
@retval SHELL_NOT_FOUND The protocol was not found.
|
|
|
|
@retval SHELL_INVALID_PARAMETER Protocol is invalid parameter.
|
2011-03-25 22:13:43 +01:00
|
|
|
**/
|
2010-11-12 20:40:21 +01:00
|
|
|
SHELL_STATUS
|
2017-01-09 03:51:58 +01:00
|
|
|
DoDhByProtocol (
|
|
|
|
IN CONST CHAR16 *Protocol,
|
2012-01-10 21:53:26 +01:00
|
|
|
IN CONST BOOLEAN Verbose,
|
2010-11-12 20:40:21 +01:00
|
|
|
IN CONST BOOLEAN Sfo,
|
|
|
|
IN CONST CHAR8 *Language,
|
|
|
|
IN CONST BOOLEAN DriverInfo
|
|
|
|
)
|
|
|
|
{
|
2017-01-09 03:51:58 +01:00
|
|
|
EFI_GUID Guid;
|
|
|
|
EFI_GUID *GuidPtr;
|
2010-11-12 20:40:21 +01:00
|
|
|
EFI_STATUS Status;
|
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
if (Protocol == NULL) {
|
|
|
|
return DoDhByProtocolGuid (NULL, Verbose, Sfo, Language, DriverInfo);
|
|
|
|
} else {
|
|
|
|
Status = ConvertStrToGuid (Protocol, &Guid);
|
|
|
|
if (!EFI_ERROR (Status)) {
|
|
|
|
GuidPtr = &Guid;
|
|
|
|
} else {
|
|
|
|
//
|
|
|
|
// Protocol is a Name, convert it to GUID
|
|
|
|
//
|
|
|
|
Status = GetGuidFromStringName (Protocol, Language, &GuidPtr);
|
|
|
|
if (EFI_ERROR(Status)) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_NAME_FOUND), gShellDriver1HiiHandle, Protocol);
|
|
|
|
return (SHELL_NOT_FOUND);
|
|
|
|
}
|
|
|
|
}
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
return DoDhByProtocolGuid (GuidPtr, Verbose, Sfo, Language, DriverInfo);
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
2017-01-09 03:51:58 +01:00
|
|
|
}
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
/**
|
|
|
|
Function to display decode information by Protocol.
|
|
|
|
The parameter Protocol is either a GUID or the name of protocol.
|
|
|
|
If the parameter Protocol is NULL, the function will print all
|
|
|
|
decode information.
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
@param[in] Protocol The pointer to the name or GUID of protocol.
|
|
|
|
@param[in] Language Language string per UEFI specification.
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
@retval SHELL_SUCCESS The operation was successful.
|
|
|
|
@retval SHELL_OUT_OT_RESOURCES A memory allocation failed.
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
DoDecodeByProtocol(
|
|
|
|
IN CONST CHAR16 *Protocol,
|
|
|
|
IN CONST CHAR8 *Language
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_GUID *Guids;
|
|
|
|
EFI_GUID Guid;
|
|
|
|
UINTN Counts;
|
|
|
|
UINTN Index;
|
|
|
|
CHAR16 *Name;
|
|
|
|
|
|
|
|
if (Protocol == NULL) {
|
|
|
|
Counts = 0;
|
|
|
|
Status = GetAllMappingGuids (NULL, &Counts);
|
|
|
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
|
|
|
Guids = AllocatePool (Counts * sizeof(EFI_GUID));
|
|
|
|
if (Guids == NULL) {
|
|
|
|
return SHELL_OUT_OF_RESOURCES;
|
|
|
|
}
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
Status = GetAllMappingGuids (Guids, &Counts);
|
|
|
|
if (Status == EFI_SUCCESS) {
|
|
|
|
for (Index = 0; Index < Counts; Index++) {
|
|
|
|
Name = GetStringNameFromGuid (&Guids[Index], Language);
|
|
|
|
if (Name != NULL) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DECODE), gShellDriver1HiiHandle, Name, &Guids[Index]);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_GUID_FOUND), gShellDriver1HiiHandle, &Guids[Index]);
|
|
|
|
}
|
|
|
|
SHELL_FREE_NON_NULL (Name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FreePool (Guids);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (ConvertStrToGuid (Protocol, &Guid) == EFI_SUCCESS) {
|
|
|
|
Name = GetStringNameFromGuid (&Guid, Language);
|
|
|
|
if (Name != NULL) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DECODE), gShellDriver1HiiHandle, Name, &Guid);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_GUID_FOUND), gShellDriver1HiiHandle, &Guid);
|
|
|
|
}
|
|
|
|
SHELL_FREE_NON_NULL(Name);
|
|
|
|
} else {
|
|
|
|
Status = GetGuidFromStringName (Protocol, Language, &Guids);
|
|
|
|
if (Status == EFI_SUCCESS) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DECODE), gShellDriver1HiiHandle, Protocol, Guids);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_NAME_FOUND), gShellDriver1HiiHandle, Protocol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return SHELL_SUCCESS;
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
|
|
|
|
2011-03-25 22:13:43 +01:00
|
|
|
/**
|
|
|
|
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).
|
|
|
|
**/
|
2010-11-12 20:40:21 +01:00
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunDh (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
LIST_ENTRY *Package;
|
|
|
|
CHAR16 *ProblemParam;
|
|
|
|
SHELL_STATUS ShellStatus;
|
|
|
|
CHAR8 *Language;
|
|
|
|
CONST CHAR16 *Lang;
|
2017-01-05 06:29:50 +01:00
|
|
|
CONST CHAR16 *RawValue;
|
2017-01-09 03:51:58 +01:00
|
|
|
CONST CHAR16 *ProtocolVal;
|
2017-01-05 06:29:50 +01:00
|
|
|
BOOLEAN SfoFlag;
|
|
|
|
BOOLEAN DriverFlag;
|
|
|
|
BOOLEAN VerboseFlag;
|
2011-03-25 22:13:43 +01:00
|
|
|
UINT64 Intermediate;
|
2017-01-09 03:51:58 +01:00
|
|
|
EFI_HANDLE Handle;
|
2010-11-12 20:40:21 +01:00
|
|
|
|
|
|
|
ShellStatus = SHELL_SUCCESS;
|
|
|
|
Status = EFI_SUCCESS;
|
|
|
|
Language = NULL;
|
|
|
|
|
|
|
|
//
|
|
|
|
// initialize the shell lib (we must be in non-auto-init...)
|
|
|
|
//
|
|
|
|
Status = ShellInitialize();
|
|
|
|
ASSERT_EFI_ERROR(Status);
|
|
|
|
|
|
|
|
Status = CommandInit();
|
|
|
|
ASSERT_EFI_ERROR(Status);
|
|
|
|
|
|
|
|
//
|
|
|
|
// parse the command line
|
|
|
|
//
|
|
|
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
|
|
|
if (EFI_ERROR(Status)) {
|
|
|
|
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
2015-02-03 20:04:52 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"dh", ProblemParam);
|
2010-11-12 20:40:21 +01:00
|
|
|
FreePool(ProblemParam);
|
|
|
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
|
|
|
} else {
|
|
|
|
ASSERT(FALSE);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (ShellCommandLineGetCount(Package) > 2) {
|
2015-02-03 20:04:52 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"dh");
|
2010-11-12 20:40:21 +01:00
|
|
|
ShellCommandLineFreeVarList (Package);
|
|
|
|
return (SHELL_INVALID_PARAMETER);
|
|
|
|
}
|
|
|
|
|
2017-01-05 06:29:50 +01:00
|
|
|
if (ShellCommandLineGetFlag(Package, L"-l")) {
|
|
|
|
Lang = ShellCommandLineGetValue(Package, L"-l");
|
|
|
|
if (Lang != NULL) {
|
|
|
|
Language = AllocateZeroPool(StrSize(Lang));
|
|
|
|
AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
|
|
|
|
} else {
|
|
|
|
ASSERT(Language == NULL);
|
|
|
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-l");
|
|
|
|
ShellCommandLineFreeVarList(Package);
|
|
|
|
return (SHELL_INVALID_PARAMETER);
|
|
|
|
}
|
|
|
|
} else {
|
2010-11-12 20:40:21 +01:00
|
|
|
Language = AllocateZeroPool(10);
|
|
|
|
AsciiSPrint(Language, 10, "en-us");
|
|
|
|
}
|
|
|
|
|
2017-01-05 06:29:50 +01:00
|
|
|
SfoFlag = ShellCommandLineGetFlag (Package, L"-sfo");
|
|
|
|
DriverFlag = ShellCommandLineGetFlag (Package, L"-d");
|
|
|
|
VerboseFlag = (BOOLEAN)(ShellCommandLineGetFlag (Package, L"-v") || ShellCommandLineGetFlag (Package, L"-verbose"));
|
2017-01-09 03:51:58 +01:00
|
|
|
RawValue = ShellCommandLineGetRawValue (Package, 1);
|
|
|
|
ProtocolVal = ShellCommandLineGetValue (Package, L"-p");
|
2010-11-12 20:40:21 +01:00
|
|
|
|
2017-01-09 03:51:58 +01:00
|
|
|
if (RawValue == NULL) {
|
|
|
|
if (ShellCommandLineGetFlag (Package, L"-p") && (ProtocolVal == NULL)) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-p");
|
2010-11-12 20:40:21 +01:00
|
|
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
|
|
|
} else {
|
|
|
|
//
|
2017-01-09 03:51:58 +01:00
|
|
|
// Print information by protocol, The ProtocolVal maybe is name or GUID or NULL.
|
2010-11-12 20:40:21 +01:00
|
|
|
//
|
2017-01-09 03:51:58 +01:00
|
|
|
ShellStatus = DoDhByProtocol (ProtocolVal, VerboseFlag, SfoFlag, Language, DriverFlag);
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
2017-01-09 03:51:58 +01:00
|
|
|
} else if ((RawValue != NULL) &&
|
|
|
|
(gUnicodeCollation->StriColl(gUnicodeCollation, L"decode", (CHAR16 *) RawValue) == 0)) {
|
|
|
|
if (ShellCommandLineGetFlag (Package, L"-p") && (ProtocolVal == NULL)) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-p");
|
|
|
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
|
|
|
} else {
|
2010-11-12 20:40:21 +01:00
|
|
|
//
|
2017-01-09 03:51:58 +01:00
|
|
|
// Print decode informatino by protocol.
|
2010-11-12 20:40:21 +01:00
|
|
|
//
|
2017-01-09 03:51:58 +01:00
|
|
|
ShellStatus = DoDecodeByProtocol (ProtocolVal, Language);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (ShellCommandLineGetFlag (Package, L"-p")) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"dh");
|
|
|
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
2010-11-12 20:40:21 +01:00
|
|
|
} else {
|
2017-01-09 03:51:58 +01:00
|
|
|
Status = ShellConvertStringToUint64 (RawValue, &Intermediate, TRUE, FALSE);
|
|
|
|
if (EFI_ERROR(Status)) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"dh", RawValue);
|
2010-11-12 20:40:21 +01:00
|
|
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
|
|
|
} else {
|
2017-01-09 03:51:58 +01:00
|
|
|
Handle = ConvertHandleIndexToHandle ((UINTN) Intermediate);
|
|
|
|
if (Handle == NULL) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"dh", RawValue);
|
|
|
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
|
|
|
} else {
|
|
|
|
//
|
|
|
|
// Print information by handle.
|
|
|
|
//
|
|
|
|
DoDhByHandle (Handle, VerboseFlag, SfoFlag, Language, DriverFlag, FALSE);
|
|
|
|
}
|
2010-11-12 20:40:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ShellCommandLineFreeVarList (Package);
|
|
|
|
SHELL_FREE_NON_NULL(Language);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ShellStatus);
|
|
|
|
}
|