/** @file\r
Main file for DevTree shell Driver1 function.\r
\r
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
return SHELL_SUCCESS;\r
}\r
\r
- //\r
- // If we are at the begining then we want root handles they have no parents and do have device path.\r
- //\r
- if (IndentCharCount == 0) {\r
- Status = gBS->OpenProtocol (\r
- TheHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- NULL,\r
- NULL,\r
- NULL,\r
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return SHELL_SUCCESS;\r
- }\r
- }\r
-\r
FormatString = AllocateZeroPool(StrSize(HiiString) + (10)*sizeof(FormatString[0]));\r
\r
ASSERT(HiiString != NULL);\r
EFI_HANDLE TheHandle;\r
BOOLEAN FlagD;\r
UINT64 Intermediate;\r
+ UINTN ParentControllerHandleCount;\r
+ EFI_HANDLE *ParentControllerHandleBuffer;\r
\r
ShellStatus = SHELL_SUCCESS;\r
Status = EFI_SUCCESS;\r
if (TheHandle == NULL){\r
break;\r
}\r
+\r
+ //\r
+ // Skip handles that do not have device path protocol\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ TheHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ NULL,\r
+ NULL,\r
+ NULL,\r
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ continue;\r
+ }\r
+\r
+ //\r
+ // Skip handles that do have parents\r
+ //\r
+ ParentControllerHandleBuffer = NULL;\r
+ Status = PARSE_HANDLE_DATABASE_PARENTS (\r
+ TheHandle,\r
+ &ParentControllerHandleCount,\r
+ &ParentControllerHandleBuffer\r
+ );\r
+ SHELL_FREE_NON_NULL (ParentControllerHandleBuffer);\r
+ if (ParentControllerHandleCount > 0) {\r
+ continue;\r
+ }\r
+\r
+ //\r
+ // Start a devtree from TheHandle that has a device path and no parents\r
+ //\r
ShellStatus = DoDevTreeForHandle(TheHandle, Language, FlagD, 0, HiiString);\r
}\r
} else {\r