connect - add comments and add input verification
devices - add comments and add input verification devtree - add comments and add input verification dh - add comments, add input verification, add support for "-d" disconnect - add comments and add input verification drivers - add comments drvcfg - add comment drvdiag - add comments, add input verification, and fix language use openinfo - add comments and add input verification reconnect - add comment unload - add input verification. main library files: add comments, #define protection, and more output to the user. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11434 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Main file for Dh shell Driver1 function.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@ -40,6 +40,88 @@ STATIC CONST EFI_GUID *UefiDriverModelProtocolsGuidArray[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
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
|
||||
EFIAPI
|
||||
GetDriverName (
|
||||
IN EFI_HANDLE TheHandle,
|
||||
IN CONST CHAR8 *Language,
|
||||
IN CHAR16 **NameFound
|
||||
)
|
||||
{
|
||||
CHAR8 *Lang;
|
||||
CHAR8 *TempChar;
|
||||
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);
|
||||
}
|
||||
if (Language == NULL) {
|
||||
Lang = AllocateZeroPool(AsciiStrSize(CompName2->SupportedLanguages));
|
||||
if (Lang == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
AsciiStrCpy(Lang, CompName2->SupportedLanguages);
|
||||
TempChar = AsciiStrStr(Lang, ";");
|
||||
if (TempChar != NULL){
|
||||
*TempChar = CHAR_NULL;
|
||||
}
|
||||
} else {
|
||||
Lang = AllocateZeroPool(AsciiStrSize(Language));
|
||||
if (Lang == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
AsciiStrCpy(Lang, Language);
|
||||
}
|
||||
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.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
IsDriverProt (
|
||||
@ -61,13 +143,24 @@ IsDriverProt (
|
||||
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.
|
||||
**/
|
||||
CHAR16*
|
||||
EFIAPI
|
||||
GetProtocolInfoString(
|
||||
IN CONST EFI_HANDLE TheHandle,
|
||||
IN CONST CHAR8 *Language,
|
||||
IN CONST CHAR16 *Seperator,
|
||||
IN CONST BOOLEAN DriverInfo,
|
||||
IN CONST BOOLEAN Verbose,
|
||||
IN CONST BOOLEAN ExtraInfo
|
||||
)
|
||||
@ -81,6 +174,8 @@ GetProtocolInfoString(
|
||||
CHAR16 *Temp;
|
||||
|
||||
ProtocolGuidArray = NULL;
|
||||
RetVal = NULL;
|
||||
Size = 0;
|
||||
|
||||
Status = gBS->ProtocolsPerHandle (
|
||||
TheHandle,
|
||||
@ -88,8 +183,6 @@ GetProtocolInfoString(
|
||||
&ArrayCount
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
RetVal = NULL;
|
||||
Size = 0;
|
||||
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
|
||||
Temp = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], Language);
|
||||
if (Temp != NULL) {
|
||||
@ -118,18 +211,448 @@ GetProtocolInfoString(
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL(ProtocolGuidArray);
|
||||
|
||||
if (RetVal == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (ProtocolGuidArray != NULL) {
|
||||
FreePool(ProtocolGuidArray);
|
||||
}
|
||||
ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
|
||||
StrnCatGrow(&RetVal, &Size, Seperator, 0);
|
||||
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.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
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;
|
||||
*Name = gDevPathToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE);
|
||||
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
|
||||
EFIAPI
|
||||
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;
|
||||
|
||||
//
|
||||
// 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);
|
||||
|
||||
TempStringPointer = gDevPathToText->ConvertDevicePathToText(DevicePath, TRUE, FALSE);
|
||||
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
|
||||
);
|
||||
if (DriverName == NULL) {
|
||||
Status = GetDriverImageName (
|
||||
DriverBindingHandleBuffer[Index],
|
||||
&DriverName
|
||||
);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6B),
|
||||
gShellDriver1HiiHandle,
|
||||
ConvertHandleToHandleIndex(Handle),
|
||||
DriverName!=NULL?DriverName:L"<Unknown>"
|
||||
);
|
||||
SHELL_FREE_NON_NULL(DriverName);
|
||||
DriverName = NULL;
|
||||
Status = GetDriverImageName (
|
||||
Handle,
|
||||
&DriverName
|
||||
);
|
||||
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,
|
||||
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6),
|
||||
gShellDriver1HiiHandle,
|
||||
L"None"
|
||||
);
|
||||
} else {
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6),
|
||||
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,
|
||||
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6B),
|
||||
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.
|
||||
|
||||
@retval SHELL_SUCCESS The operation was successful.
|
||||
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
DoDhByHandle(
|
||||
@ -151,7 +674,7 @@ DoDhByHandle(
|
||||
|
||||
if (!Sfo) {
|
||||
if (Multiple) {
|
||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L" ", DriverInfo, Verbose, TRUE);
|
||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L" ", Verbose, TRUE);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
@ -161,7 +684,7 @@ DoDhByHandle(
|
||||
ConvertHandleToHandleIndex(TheHandle),
|
||||
ProtocolInfoString==NULL?L"":ProtocolInfoString);
|
||||
} else {
|
||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L"\r\n", DriverInfo, Verbose, TRUE);
|
||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L"\r\n", Verbose, TRUE);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
@ -172,9 +695,12 @@ DoDhByHandle(
|
||||
TheHandle,
|
||||
ProtocolInfoString==NULL?L"":ProtocolInfoString);
|
||||
}
|
||||
|
||||
if (DriverInfo) {
|
||||
DisplayDriverModelHandle ((EFI_HANDLE)TheHandle, TRUE, Language);
|
||||
}
|
||||
} else {
|
||||
//#string STR_DH_OUTPUT_SFO #language en-US "%s, %s, %s, %H%02x%N, %s, %s\r\n"
|
||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L";", DriverInfo, FALSE, FALSE);
|
||||
ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L";", FALSE, FALSE);
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
@ -198,6 +724,17 @@ DoDhByHandle(
|
||||
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.
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
DoDhForHandleList(
|
||||
@ -225,6 +762,16 @@ DoDhForHandleList(
|
||||
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.
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
DoDhForAll(
|
||||
@ -249,6 +796,17 @@ DoDhForAll(
|
||||
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.
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
DoDhByProtocol(
|
||||
@ -263,7 +821,9 @@ DoDhByProtocol(
|
||||
EFI_HANDLE *HandleList;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ASSERT(ProtocolName != NULL);
|
||||
if (ProtocolName == NULL) {
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
Status = GetGuidFromStringName(ProtocolName, Language, &Guid);
|
||||
if (EFI_ERROR(Status)) {
|
||||
@ -284,6 +844,12 @@ DoDhByProtocol(
|
||||
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).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunDh (
|
||||
@ -301,6 +867,7 @@ ShellCommandRunDh (
|
||||
BOOLEAN SfoMode;
|
||||
BOOLEAN FlagD;
|
||||
BOOLEAN Verbose;
|
||||
UINT64 Intermediate;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
@ -350,11 +917,7 @@ ShellCommandRunDh (
|
||||
|
||||
SfoMode = ShellCommandLineGetFlag(Package, L"-sfo");
|
||||
FlagD = ShellCommandLineGetFlag(Package, L"-d");
|
||||
if (ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose")) {
|
||||
Verbose = TRUE;
|
||||
} else {
|
||||
Verbose = FALSE;
|
||||
}
|
||||
Verbose = (BOOLEAN)(ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose"));
|
||||
|
||||
if (ShellCommandLineGetFlag(Package, L"-p")) {
|
||||
if (ShellCommandLineGetCount(Package) > 1) {
|
||||
@ -386,7 +949,8 @@ ShellCommandRunDh (
|
||||
FlagD
|
||||
);
|
||||
} else {
|
||||
if (!ShellIsHexOrDecimalNumber(Temp2, TRUE, FALSE) || ConvertHandleIndexToHandle(StrHexToUintn(Temp2)) == NULL) {
|
||||
Status = ShellConvertStringToUint64(Temp2, &Intermediate, TRUE, FALSE);
|
||||
if (EFI_ERROR(Status) || ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Temp2);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
@ -394,7 +958,7 @@ ShellCommandRunDh (
|
||||
// print 1 handle
|
||||
//
|
||||
ShellStatus = DoDhByHandle(
|
||||
ConvertHandleIndexToHandle(StrHexToUintn(Temp2)),
|
||||
ConvertHandleIndexToHandle((UINTN)Intermediate),
|
||||
Verbose,
|
||||
SfoMode,
|
||||
Lang==NULL?NULL:Language,
|
||||
|
Reference in New Issue
Block a user