]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/HandleParsingLib: Add new API GetAllMappingGuids
authorChen A Chen <chen.a.chen@intel.com>
Thu, 29 Dec 2016 06:52:45 +0000 (14:52 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 11 Jan 2017 02:07:07 +0000 (10:07 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/Include/Library/HandleParsingLib.h
ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c

index 79dcc9cc5a557a9f4b1d10d2a0cc421d9513cacb..b02cf4f08924d6df3a4afcca1fb4e46af6163f12 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) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2017, 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
@@ -388,4 +388,23 @@ GetHandleListByProtocolList (
   IN CONST EFI_GUID **ProtocolGuids\r
   );\r
 \r
+\r
+/**\r
+  Return all supported GUIDs.\r
+\r
+  @param[out]     Guids  The buffer to return all supported GUIDs.\r
+  @param[in out]  Count  On input, the count of GUIDs the buffer can hold,\r
+                         On output, the count of GUIDs to return.\r
+\r
+  @retval EFI_INVALID_PARAMETER Count is NULL.\r
+  @retval EFI_BUFFER_TOO_SMALL  Buffer is not enough to hold all GUIDs.\r
+  @retval EFI_SUCCESS           GUIDs are returned successfully.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetAllMappingGuids (\r
+  OUT EFI_GUID *Guids,\r
+  IN OUT UINTN *Count\r
+  );\r
+\r
 #endif // __HANDLE_PARSING_LIB__\r
index 780c4587b821a1bc20b61f76576ebe62756b897b..b4cd1b3bee553b1ec93f27144fda5f1e1e4a82b0 100644 (file)
@@ -3079,3 +3079,55 @@ GetHandleListByProtocolList (
 \r
   return (HandleList);\r
 }\r
+\r
+/**\r
+  Return all supported GUIDs.\r
+\r
+  @param[out]     Guids  The buffer to return all supported GUIDs.\r
+  @param[in, out] Count  On input, the count of GUIDs the buffer can hold,\r
+                         On output, the count of GUIDs to return.\r
+\r
+  @retval EFI_INVALID_PARAMETER Count is NULL.\r
+  @retval EFI_BUFFER_TOO_SMALL  Buffer is not enough to hold all GUIDs.\r
+  @retval EFI_SUCCESS           GUIDs are returned successfully.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetAllMappingGuids (\r
+  OUT EFI_GUID *Guids,\r
+  IN OUT UINTN *Count\r
+  )\r
+{\r
+  UINTN GuidCount;\r
+  UINTN NtGuidCount\r
+  UINTN Index;\r
+\r
+  if (Count == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  NtGuidCount = 0;\r
+  if (PcdGetBool (PcdShellIncludeNtGuids)) {\r
+    NtGuidCount = ARRAY_SIZE (mGuidStringListNT) - 1;\r
+  }\r
+  GuidCount   = ARRAY_SIZE (mGuidStringList) - 1;\r
+\r
+  if (*Count < NtGuidCount + GuidCount + mGuidListCount) {\r
+    *Count = NtGuidCount + GuidCount + mGuidListCount;\r
+    return EFI_BUFFER_TOO_SMALL;\r
+  }\r
+\r
+  for (Index = 0; Index < NtGuidCount; Index++) {\r
+    CopyGuid (&Guids[Index], mGuidStringListNT[Index].GuidId);\r
+  }\r
+\r
+  for (Index = 0; Index < GuidCount; Index++) {\r
+    CopyGuid (&Guids[NtGuidCount + Index], mGuidStringList[Index].GuidId);\r
+  }\r
+\r
+  for (Index = 0; Index < mGuidListCount; Index++) {\r
+    CopyGuid (&Guids[NtGuidCount + GuidCount + Index], mGuidList[Index].GuidId);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r