]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Update Shell DH command to display more info.
authorSamer El-Haj-Mahmoud <elhaj@hp.com>
Tue, 25 Nov 2014 22:41:30 +0000 (22:41 +0000)
committerjcarsey <jcarsey@Edk2>
Tue, 25 Nov 2014 22:41:30 +0000 (22:41 +0000)
Decode for gEfiAdapterInformationProtocolGuid and added GUIDs for gEfiIsaIoProtocolGuid and gEfiIsaAcpiProtocolGuid protocols.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hp.com>
Reviewed-by: jaben carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16445 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni

index 4921f2816d0840c4e6c67cfc9fc3a6ecb1bba15f..9c6cf61af5ce917e64eaa7700edb9673e45465a9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provides interface to advanced shell functionality for parsing both handle and protocol database.\r
 \r
-  Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.\r
+  Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2010 - 2014, 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
@@ -581,6 +581,167 @@ DevicePathProtocolDumpInformation(
   return (Temp);\r
 }\r
 \r
+/**\r
+  Function to dump information about EfiAdapterInformation Protocol.\r
+\r
+  @param[in] TheHandle      The handle that has the protocol installed.\r
+  @param[in] Verbose        TRUE for additional information, FALSE otherwise.\r
+\r
+  @retval A pointer to a string containing the information.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+AdapterInformationDumpInformation (\r
+  IN CONST EFI_HANDLE TheHandle,\r
+  IN CONST BOOLEAN    Verbose\r
+  )\r
+{\r
+  EFI_STATUS                        Status;\r
+  EFI_ADAPTER_INFORMATION_PROTOCOL  *EfiAdptrInfoProtocol;\r
+  UINTN                             InfoTypesBufferCount;\r
+  UINTN                             GuidIndex;\r
+  EFI_GUID                          *InfoTypesBuffer;\r
+  CHAR16                            *GuidStr;\r
+  CHAR16                            *TempStr;\r
+  CHAR16                            *RetVal;\r
+  VOID                              *InformationBlock;\r
+  UINTN                             InformationBlockSize;\r
+   \r
+  if (!Verbose) {\r
+    return (CatSPrint(NULL, L"AdapterInfo"));\r
+  }\r
+\r
+  //\r
+  // Allocate print buffer to store data\r
+  //\r
+  RetVal = AllocateZeroPool (PcdGet16(PcdShellPrintBufferSize));\r
+  if (RetVal == NULL) {\r
+    return NULL;\r
+  }\r
+\r
+  Status = gBS->OpenProtocol (\r
+                  (EFI_HANDLE) (TheHandle),\r
+                  &gEfiAdapterInformationProtocolGuid,\r
+                  (VOID **) &EfiAdptrInfoProtocol,\r
+                  NULL,\r
+                  NULL,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    SHELL_FREE_NON_NULL (RetVal);\r
+    return NULL;\r
+  }\r
+\r
+  //\r
+  // Get a list of supported information types for this instance of the protocol.\r
+  //\r
+  Status = EfiAdptrInfoProtocol->GetSupportedTypes (\r
+                                   EfiAdptrInfoProtocol,\r
+                                   &InfoTypesBuffer, \r
+                                   &InfoTypesBufferCount\r
+                                   );\r
+  if (EFI_ERROR (Status)) {\r
+    TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GET_SUPP_TYPES_FAILED), NULL);\r
+    RetVal = CatSPrint (RetVal, TempStr, Status);\r
+  } else {\r
+    TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SUPP_TYPE_HEADER), NULL);\r
+    RetVal = CatSPrint (RetVal, TempStr);\r
+    SHELL_FREE_NON_NULL (TempStr);\r
+\r
+    for (GuidIndex = 0; GuidIndex < InfoTypesBufferCount; GuidIndex++) {\r
+      TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_NUMBER), NULL);\r
+      RetVal = CatSPrint (RetVal, TempStr, (GuidIndex + 1), InfoTypesBuffer[GuidIndex]);\r
+      SHELL_FREE_NON_NULL (TempStr);\r
+\r
+      TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_STRING), NULL);\r
+\r
+      if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {\r
+        RetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoMediaStateGuid");\r
+      } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) {\r
+        RetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoNetworkBootGuid");\r
+      } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid)) {\r
+        RetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoSanMacAddressGuid");\r
+      } else {\r
+\r
+        GuidStr = GetStringNameFromGuid (&InfoTypesBuffer[GuidIndex], NULL);\r
+       \r
+        if (GuidStr != NULL) {\r
+          if (StrCmp(GuidStr, L"UnknownDevice") == 0) {\r
+            RetVal = CatSPrint (RetVal, TempStr, L"UnknownInfoType");\r
+            \r
+            SHELL_FREE_NON_NULL (TempStr);\r
+            SHELL_FREE_NON_NULL(GuidStr);\r
+            //\r
+            // So that we never have to pass this UnknownInfoType to the parsing function "GetInformation" service of AIP\r
+            //\r
+            continue; \r
+          } else {\r
+            RetVal = CatSPrint (RetVal, TempStr, GuidStr);\r
+            SHELL_FREE_NON_NULL(GuidStr);\r
+          }\r
+        }\r
+      }\r
+      \r
+      SHELL_FREE_NON_NULL (TempStr);\r
+\r
+      Status = EfiAdptrInfoProtocol->GetInformation (\r
+                                       EfiAdptrInfoProtocol,\r
+                                       &InfoTypesBuffer[GuidIndex],\r
+                                       &InformationBlock,\r
+                                       &InformationBlockSize\r
+                                       );\r
+\r
+      if (EFI_ERROR (Status)) {\r
+        TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GETINFO_FAILED), NULL);\r
+        RetVal = CatSPrint (RetVal, TempStr, Status);\r
+      } else {\r
+        if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {\r
+          TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_MEDIA_STATE), NULL);\r
+          RetVal = CatSPrint (\r
+                     RetVal,\r
+                     TempStr,\r
+                     ((EFI_ADAPTER_INFO_MEDIA_STATE *)InformationBlock)->MediaState,\r
+                     ((EFI_ADAPTER_INFO_MEDIA_STATE *)InformationBlock)->MediaState\r
+                     );\r
+        } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) {\r
+          TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_NETWORK_BOOT_INFO), NULL);\r
+          RetVal = CatSPrint (\r
+                     RetVal,\r
+                     TempStr,\r
+                     ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv4BootCapablity,\r
+                     ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv6BootCapablity, \r
+                     ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->FCoeBootCapablity, \r
+                     ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->OffloadCapability, \r
+                     ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiMpioCapability, \r
+                     ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv4Boot, \r
+                     ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv6Boot,\r
+                     ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->FCoeBoot\r
+                     );\r
+        } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid) == TRUE) { \r
+          TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SAN_MAC_ADDRESS_INFO), NULL);\r
+          RetVal = CatSPrint (\r
+                     RetVal,\r
+                     TempStr,\r
+                     ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[0], \r
+                     ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[1], \r
+                     ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[2],\r
+                     ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[3], \r
+                     ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[4], \r
+                     ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[5]\r
+                     );   \r
+        } else {\r
+          TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_UNKNOWN_INFO_TYPE), NULL);\r
+          RetVal = CatSPrint (RetVal, TempStr, &InfoTypesBuffer[GuidIndex]);\r
+        }\r
+      }\r
+      SHELL_FREE_NON_NULL (TempStr);\r
+      SHELL_FREE_NON_NULL (InformationBlock);\r
+    }\r
+  }\r
+\r
+  return RetVal;\r
+}\r
 //\r
 // Put the information on the NT32 protocol GUIDs here so we are not dependant on the Nt32Pkg\r
 //\r
@@ -713,6 +874,8 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
   {STRING_TOKEN(STR_GPT_NBR),               &gEfiPartTypeLegacyMbrGuid,                       NULL},\r
   {STRING_TOKEN(STR_DRIVER_CONFIG),         &gEfiDriverConfigurationProtocolGuid,             NULL},\r
   {STRING_TOKEN(STR_DRIVER_CONFIG2),        &gEfiDriverConfiguration2ProtocolGuid,            NULL},\r
+  {STRING_TOKEN(STR_ISA_IO),                &gEfiIsaIoProtocolGuid,                           NULL},\r
+  {STRING_TOKEN(STR_ISA_ACPI),              &gEfiIsaAcpiProtocolGuid,                         NULL},\r
 \r
 //\r
 // the ones under this are GUID identified structs, not protocols\r
@@ -770,7 +933,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
 // UEFI 2.4\r
 //\r
   {STRING_TOKEN(STR_DISK_IO2),              &gEfiDiskIo2ProtocolGuid,                         NULL},\r
-  {STRING_TOKEN(STR_ADAPTER_INFO),          &gEfiAdapterInformationProtocolGuid,              NULL},\r
+  {STRING_TOKEN(STR_ADAPTER_INFO),          &gEfiAdapterInformationProtocolGuid,              AdapterInformationDumpInformation},\r
 \r
 //\r
 // PI Spec ones\r
index c1735a64aed5be3ad68819959ff072fcedeb72b3..ba6e152d3b747b951d4c619ea1eb3f074851901e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provides interface to advanced shell functionality for parsing both handle and protocol database.\r
 \r
-  Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.\r
+  Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2011 - 2014, 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
 #include <Protocol/DiskIo2.h>\r
 #include <Protocol/AdapterInformation.h>\r
 #include <Protocol/EfiShellDynamicCommand.h>\r
+#include <Protocol/IsaIo.h>\r
+#include <Protocol/IsaAcpi.h>\r
 \r
 #include <Library/HandleParsingLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
index 6c30552503fa0ebc4fb7dd78ebedcce1d0ab442f..dc978766672c8ebb36d10ae0eb3f4e5bbda451df 100644 (file)
@@ -1,6 +1,6 @@
 ##  @file\r
 #  Provides interface to advanced shell functionality for parsing both handle and protocol database.\r
-#  Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.\r
+#  Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>\r
 #  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>\r
 #\r
 #  This program and the accompanying materials\r
@@ -36,6 +36,7 @@
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
   ShellPkg/ShellPkg.dec\r
+  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
 \r
 [LibraryClasses]\r
   UefiBootServicesTableLib\r
   gEfiIdeControllerInitProtocolGuid                       ##UNDEFINED\r
   gEfiDiskIo2ProtocolGuid                                 ##UNDEFINED\r
   gEfiAdapterInformationProtocolGuid                      ##UNDEFINED\r
+  gEfiIsaIoProtocolGuid                                   ##UNDEFINED\r
+  gEfiIsaAcpiProtocolGuid                                 ##UNDEFINED\r
+  gEfiShellDynamicCommandProtocolGuid                     ##UNDEFINED\r
 \r
 [Guids]\r
   gEfiFileInfoGuid                                        ##CONSUMES\r
   gEfiPartTypeSystemPartGuid                              ##UNDEFINED\r
   gEfiPartTypeLegacyMbrGuid                               ##UNDEFINED\r
   gHandleParsingHiiGuid                                   ##UNDEFINED\r
+  gEfiAdapterInfoMediaStateGuid                           ##SOMETIMES CONSUMES\r
+  gEfiAdapterInfoNetworkBootGuid                          ##SOMETIMES CONSUMES\r
+  gEfiAdapterInfoSanMacAddressGuid                        ##SOMETIMES CONSUMES\r
 \r
 [Pcd.common]\r
   gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize      ##CONSUMES\r
index 36acfb10b215ead20b26216c051c82aabb437318..364fd9c4835b4f2a9f37272c14b20f9d507679d4 100644 (file)
Binary files a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni and b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni differ