From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Chen A Chen <chen.a.chen@intel.com>
Subject: [PATCH 3/5] ShellPkg/HandleParsingLib: Add new API GetAllMappingGuids
Date: Mon, 9 Jan 2017 17:30:50 +0800 [thread overview]
Message-ID: <20170109093052.140504-4-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20170109093052.140504-1-ruiyu.ni@intel.com>
From: Chen A Chen <chen.a.chen@intel.com>
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>
---
ShellPkg/Include/Library/HandleParsingLib.h | 21 ++++++++-
.../UefiHandleParsingLib/UefiHandleParsingLib.c | 52 ++++++++++++++++++++++
2 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/ShellPkg/Include/Library/HandleParsingLib.h b/ShellPkg/Include/Library/HandleParsingLib.h
index 79dcc9c..b02cf4f 100644
--- a/ShellPkg/Include/Library/HandleParsingLib.h
+++ b/ShellPkg/Include/Library/HandleParsingLib.h
@@ -1,7 +1,7 @@
/** @file
Provides interface to advanced shell functionality for parsing both handle and protocol database.
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2017, 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
@@ -388,4 +388,23 @@ GetHandleListByProtocolList (
IN CONST EFI_GUID **ProtocolGuids
);
+
+/**
+ Return all supported GUIDs.
+
+ @param[out] Guids The buffer to return all supported GUIDs.
+ @param[in out] Count On input, the count of GUIDs the buffer can hold,
+ On output, the count of GUIDs to return.
+
+ @retval EFI_INVALID_PARAMETER Count is NULL.
+ @retval EFI_BUFFER_TOO_SMALL Buffer is not enough to hold all GUIDs.
+ @retval EFI_SUCCESS GUIDs are returned successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetAllMappingGuids (
+ OUT EFI_GUID *Guids,
+ IN OUT UINTN *Count
+ );
+
#endif // __HANDLE_PARSING_LIB__
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index 780c458..b4cd1b3 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -3079,3 +3079,55 @@ GetHandleListByProtocolList (
return (HandleList);
}
+
+/**
+ Return all supported GUIDs.
+
+ @param[out] Guids The buffer to return all supported GUIDs.
+ @param[in, out] Count On input, the count of GUIDs the buffer can hold,
+ On output, the count of GUIDs to return.
+
+ @retval EFI_INVALID_PARAMETER Count is NULL.
+ @retval EFI_BUFFER_TOO_SMALL Buffer is not enough to hold all GUIDs.
+ @retval EFI_SUCCESS GUIDs are returned successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetAllMappingGuids (
+ OUT EFI_GUID *Guids,
+ IN OUT UINTN *Count
+ )
+{
+ UINTN GuidCount;
+ UINTN NtGuidCount
+ UINTN Index;
+
+ if (Count == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ NtGuidCount = 0;
+ if (PcdGetBool (PcdShellIncludeNtGuids)) {
+ NtGuidCount = ARRAY_SIZE (mGuidStringListNT) - 1;
+ }
+ GuidCount = ARRAY_SIZE (mGuidStringList) - 1;
+
+ if (*Count < NtGuidCount + GuidCount + mGuidListCount) {
+ *Count = NtGuidCount + GuidCount + mGuidListCount;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ for (Index = 0; Index < NtGuidCount; Index++) {
+ CopyGuid (&Guids[Index], mGuidStringListNT[Index].GuidId);
+ }
+
+ for (Index = 0; Index < GuidCount; Index++) {
+ CopyGuid (&Guids[NtGuidCount + Index], mGuidStringList[Index].GuidId);
+ }
+
+ for (Index = 0; Index < mGuidListCount; Index++) {
+ CopyGuid (&Guids[NtGuidCount + GuidCount + Index], mGuidList[Index].GuidId);
+ }
+
+ return EFI_SUCCESS;
+}
--
2.9.0.windows.1
next prev parent reply other threads:[~2017-01-09 9:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-09 9:30 [PATCH 0/5] Change "dh" to support dump from GUID and "decode" parameter Ruiyu Ni
2017-01-09 9:30 ` [PATCH 1/5] ShellPkg/HandleParsingLib: Rename global variables Ruiyu Ni
2017-01-09 9:30 ` [PATCH 2/5] ShellPkg/HandleParsingLib: Return NULL name for unknown GUID Ruiyu Ni
2017-01-09 9:30 ` Ruiyu Ni [this message]
2017-01-09 9:30 ` [PATCH 4/5] ShellPkg/Dh: Fix coding style issues Ruiyu Ni
2017-01-09 15:36 ` Carsey, Jaben
2017-01-10 2:24 ` Ni, Ruiyu
2017-01-10 16:20 ` Carsey, Jaben
2017-01-09 9:30 ` [PATCH 5/5] ShellPkg/dh: Support dump from GUID and "decode" parameter Ruiyu Ni
2017-01-09 15:40 ` [PATCH 0/5] Change "dh" to support " Carsey, Jaben
2017-01-10 2:23 ` Ni, Ruiyu
2017-01-10 21:43 ` Carsey, Jaben
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170109093052.140504-4-ruiyu.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox