]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c
add comments to function declarations and definitions and updated to match coding...
[mirror_edk2.git] / ShellPkg / Library / UefiShellDriver1CommandsLib / Devices.c
index 1af17738495e37902bc96213ddd09e2f56144b0e..a6e27e93dac620566f063a1cfc13ffdac6f048a5 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for devices shell Driver1 function.\r
 \r
-  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2011, 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
 \r
 #include "UefiShellDriver1CommandsLib.h"\r
 \r
+/**\r
+  Get lots of info about a device from its handle.\r
+\r
+  @param[in] TheHandle      The device handle to get info on.\r
+  @param[in,out] Type       On successful return R, B, or D (root, bus, or \r
+                            device) will be placed in this buffer.\r
+  @param[in,out] Cfg        On successful return this buffer will be \r
+                            TRUE if the handle has configuration, FALSE\r
+                            otherwise.\r
+  @param[in,out] Diag       On successful return this buffer will be \r
+                            TRUE if the handle has disgnostics, FALSE\r
+                            otherwise.\r
+  @param[in,out] Parents    On successful return this buffer will be \r
+                            contain the number of parent handles.\r
+  @param[in,out] Devices    On successful return this buffer will be \r
+                            contain the number of devices controlled.\r
+  @param[in,out] Children   On successful return this buffer will be \r
+                            contain the number of child handles.\r
+  @param[out] Name          The pointer to a buffer that will be allocated\r
+                            and contain the string name of the handle.\r
+                            The caller must free this memory.\r
+  @param[in] Language       The language code as defined by the UEFI spec.\r
+\r
+  @retval EFI_SUCCESS           The info is there.\r
+  @retval EFI_INVALID_PARAMETER A parameter was invalid.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 GetDeviceHandleInfo (\r
   IN EFI_HANDLE   TheHandle,\r
-  IN CHAR16       *Type,\r
-  IN BOOLEAN      *Cfg,\r
-  IN BOOLEAN      *Diag,\r
-  IN UINTN        *Parents,\r
-  IN UINTN        *Devices,\r
-  IN UINTN        *Children,\r
+  IN OUT CHAR16   *Type,\r
+  IN OUT BOOLEAN  *Cfg,\r
+  IN OUT BOOLEAN  *Diag,\r
+  IN OUT UINTN    *Parents,\r
+  IN OUT UINTN    *Devices,\r
+  IN OUT UINTN    *Children,\r
   OUT CHAR16      **Name,\r
   IN CONST CHAR8  *Language\r
   )\r
@@ -56,7 +82,7 @@ GetDeviceHandleInfo (
   gEfiShellProtocol->GetDeviceName(TheHandle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, Name);\r
 \r
   Status = ParseHandleDatabaseForChildControllers(TheHandle, Children, NULL);\r
-  if (!EFI_ERROR(Status)) {\r
+//  if (!EFI_ERROR(Status)) {\r
     Status = PARSE_HANDLE_DATABASE_PARENTS(TheHandle, Parents, NULL);\r
     if (/*!EFI_ERROR(Status) && */Parents != NULL && Children != NULL) {\r
       if (*Parents == 0) {\r
@@ -67,7 +93,7 @@ GetDeviceHandleInfo (
         *Type = L'D';\r
       }\r
     }\r
-  }\r
+//  }\r
   Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS(TheHandle, Devices, &HandleBuffer);\r
   if (!EFI_ERROR(Status) && Devices != NULL && HandleBuffer != NULL) {\r
     for (Count = 0 ; Count < *Devices ; Count++) {\r
@@ -195,7 +221,7 @@ ShellCommandRunDevices (
         //\r
         Name = NULL;\r
         Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language);\r
-        if (Parents != 0 || Devices != 0 || Children != 0) {\r
+        if (Name != NULL && (Parents != 0 || Devices != 0 || Children != 0)) {\r
           ShellPrintHiiEx(\r
             -1,\r
             -1,\r