summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDriver1CommandsLib
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellDriver1CommandsLib')
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c54
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c14
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c6
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c10
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.unibin70094 -> 70090 bytes
5 files changed, 54 insertions, 30 deletions
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c
index a66bdec06b..1548770379 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c
@@ -1,7 +1,7 @@
/** @file
Main file for DevTree shell Driver1 function.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, 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
@@ -84,23 +84,6 @@ DoDevTreeForHandle(
return SHELL_SUCCESS;
}
- //
- // If we are at the begining then we want root handles they have no parents and do have device path.
- //
- if (IndentCharCount == 0) {
- Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiDevicePathProtocolGuid,
- NULL,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return SHELL_SUCCESS;
- }
- }
-
FormatString = AllocateZeroPool(StrSize(HiiString) + (10)*sizeof(FormatString[0]));
ASSERT(HiiString != NULL);
@@ -169,6 +152,8 @@ ShellCommandRunDevTree (
EFI_HANDLE TheHandle;
BOOLEAN FlagD;
UINT64 Intermediate;
+ UINTN ParentControllerHandleCount;
+ EFI_HANDLE *ParentControllerHandleBuffer;
ShellStatus = SHELL_SUCCESS;
Status = EFI_SUCCESS;
@@ -226,6 +211,39 @@ ShellCommandRunDevTree (
if (TheHandle == NULL){
break;
}
+
+ //
+ // Skip handles that do not have device path protocol
+ //
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiDevicePathProtocolGuid,
+ NULL,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ //
+ // Skip handles that do have parents
+ //
+ ParentControllerHandleBuffer = NULL;
+ Status = PARSE_HANDLE_DATABASE_PARENTS (
+ TheHandle,
+ &ParentControllerHandleCount,
+ &ParentControllerHandleBuffer
+ );
+ SHELL_FREE_NON_NULL (ParentControllerHandleBuffer);
+ if (ParentControllerHandleCount > 0) {
+ continue;
+ }
+
+ //
+ // Start a devtree from TheHandle that has a device path and no parents
+ //
ShellStatus = DoDevTreeForHandle(TheHandle, Language, FlagD, 0, HiiString);
}
} else {
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c
index 1b42b23add..a0dc139411 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c
@@ -1,7 +1,7 @@
/** @file
Main file for Dh shell Driver1 function.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, 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
@@ -394,11 +394,14 @@ DisplayDriverModelHandle (
Language,
&DriverName
);
- if (DriverName == NULL) {
+ if (EFI_ERROR (Status)) {
Status = GetDriverImageName (
DriverBindingHandleBuffer[Index],
&DriverName
);
+ if (EFI_ERROR (Status)) {
+ DriverName = NULL;
+ }
}
if (Image) {
@@ -537,6 +540,9 @@ DisplayDriverModelHandle (
}
Status = GetDriverName (Handle, Language, &DriverName);
+ if (EFI_ERROR (Status)) {
+ DriverName = NULL;
+ }
ShellPrintHiiEx(
-1,
@@ -548,11 +554,13 @@ DisplayDriverModelHandle (
DriverName!=NULL?DriverName:L"<Unknown>"
);
SHELL_FREE_NON_NULL(DriverName);
- DriverName = NULL;
Status = GetDriverImageName (
Handle,
&DriverName
);
+ if (EFI_ERROR (Status)) {
+ DriverName = NULL;
+ }
ShellPrintHiiEx(
-1,
-1,
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c
index 96233f9b53..a33bed9dc8 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c
@@ -1,7 +1,7 @@
/** @file
Main file for Disconnect shell Driver1 function.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, 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
@@ -163,10 +163,6 @@ ShellCommandRunDisconnect (
} else if (Param3 != NULL && Handle3 == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param3);
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiDevicePathProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
- ASSERT(Param1 != NULL);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, ShellStrToUintn(Param1), L"controller handle");
- ShellStatus = SHELL_INVALID_PARAMETER;
} else if (Handle2 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
ASSERT(Param2 != NULL);
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, ShellStrToUintn(Param2), L"driver handle");
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c
index 368948307e..2922f42d1e 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c
@@ -48,6 +48,7 @@ TraverseHandleDatabase (
CHAR16 *TempString;
UINTN HandleIndex;
CONST CHAR16 *Name;
+ UINTN ControllerIndex;
if (TheHandle == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -98,9 +99,10 @@ TraverseHandleDatabase (
OpenTypeString = StringDriverEx; break;
default: OpenTypeString = StringUnknown; break;
}
- HandleIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].AgentHandle);
- Name = GetStringNameFromHandle(OpenInfo[OpenInfoIndex].AgentHandle, NULL);
- if (OpenInfo[OpenInfoIndex].ControllerHandle!=NULL) {
+ HandleIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].AgentHandle);
+ Name = GetStringNameFromHandle(OpenInfo[OpenInfoIndex].AgentHandle, NULL);
+ ControllerIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].ControllerHandle);
+ if (ControllerIndex != 0) {
ShellPrintHiiEx(
-1,
-1,
@@ -108,7 +110,7 @@ TraverseHandleDatabase (
STRING_TOKEN(STR_OPENINFO_LINE),
gShellDriver1HiiHandle,
HandleIndex,
- ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].ControllerHandle),
+ ControllerIndex,
OpenInfo[OpenInfoIndex].OpenCount,
OpenTypeString,
Name
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
index 6c669795aa..9ffad7ec04 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
Binary files differ