From nobody Mon Dec 23 09:57:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1517620006530371.041453776263; Fri, 2 Feb 2018 17:06:46 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CB82C2237A4FC; Fri, 2 Feb 2018 17:01:05 -0800 (PST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BDAAD2237A4EC for ; Fri, 2 Feb 2018 17:01:03 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 17:06:42 -0800 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.254.102.40]) by fmsmga006.fm.intel.com with ESMTP; 02 Feb 2018 17:06:41 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,452,1511856000"; d="scan'208";a="200986001" From: "Kinney, Michael D" To: edk2-devel@lists.01.org Date: Fri, 2 Feb 2018 17:06:35 -0800 Message-Id: <20180203010638.22220-2-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20180203010638.22220-1-michael.d.kinney@intel.com> References: <20180203010638.22220-1-michael.d.kinney@intel.com> Subject: [edk2] [Patch V2 1/3] MdePkg/UefiLib: Add EfiLocateProtocolBuffer() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney , Jiewen Yao , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Michael D Kinney https://bugzilla.tianocore.org/show_bug.cgi?id=3D838 Add new API to the UefiLib that locates and returns an array of protocols instances that match a given protocol. Cc: Sean Brogan Cc: Jiewen Yao Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney Reviewed-By: Bret Barkelew Bret.Barkelew@microsoft.com Reviewed-by: Star Zeng to the patch series. --- MdePkg/Include/Library/UefiLib.h | 32 ++++++++++- MdePkg/Library/UefiLib/UefiLib.c | 112 +++++++++++++++++++++++++++++++++++= +++- 2 files changed, 142 insertions(+), 2 deletions(-) diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/Uefi= Lib.h index 0b14792a0a..54bc2cc5a3 100644 --- a/MdePkg/Include/Library/UefiLib.h +++ b/MdePkg/Include/Library/UefiLib.h @@ -12,7 +12,7 @@ of size reduction when compiler optimization is disabled. If MDEPKG_NDEB= UG is defined, then debug and assert related macros wrapped by it are the NULL= implementations. =20 -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availabl= e under=20 the terms and conditions of the BSD License that accompanies this distribu= tion. =20 The full text of the license may be found at @@ -1490,4 +1490,34 @@ CatSPrint ( ... ); =20 +/** + Returns an array of protocol instance that matches the given protocol. + + @param[in] Protocol Provides the protocol to search for. + @param[out] NoProtocols The number of protocols returned in Buffer. + @param[out] Buffer A pointer to the buffer to return the requested + array of protocol instances that match Protoco= l. + The returned buffer is allocated using + EFI_BOOT_SERVICES.AllocatePool(). The caller = is + responsible for freeing this buffer with + EFI_BOOT_SERVICES.FreePool(). + + @retval EFI_SUCCESS The array of protocols was returned in Bu= ffer, + and the number of protocols in Buffer was + returned in NoProtocols. + @retval EFI_NOT_FOUND No protocols found. + @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store = the + matching results. + @retval EFI_INVALID_PARAMETER Protocol is NULL. + @retval EFI_INVALID_PARAMETER NoProtocols is NULL. + @retval EFI_INVALID_PARAMETER Buffer is NULL. + +**/ +EFI_STATUS +EFIAPI +EfiLocateProtocolBuffer ( + IN EFI_GUID *Protocol, + OUT UINTN *NoProtocols, + OUT VOID ***Buffer + ); #endif diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/Uefi= Lib.c index a7eee01240..f1a3f1c7af 100644 --- a/MdePkg/Library/UefiLib/UefiLib.c +++ b/MdePkg/Library/UefiLib/UefiLib.c @@ -5,7 +5,7 @@ EFI Driver Model related protocols, manage Unicode string tables for UEF= I Drivers,=20 and print messages on the console output and standard error devices. =20 - Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -1605,3 +1605,113 @@ GetBestLanguage ( // return NULL; } + +/** + Returns an array of protocol instance that matches the given protocol. + + @param[in] Protocol Provides the protocol to search for. + @param[out] NoProtocols The number of protocols returned in Buffer. + @param[out] Buffer A pointer to the buffer to return the requested + array of protocol instances that match Protoco= l. + The returned buffer is allocated using + EFI_BOOT_SERVICES.AllocatePool(). The caller = is + responsible for freeing this buffer with + EFI_BOOT_SERVICES.FreePool(). + + @retval EFI_SUCCESS The array of protocols was returned in Bu= ffer, + and the number of protocols in Buffer was + returned in NoProtocols. + @retval EFI_NOT_FOUND No protocols found. + @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store = the + matching results. + @retval EFI_INVALID_PARAMETER Protocol is NULL. + @retval EFI_INVALID_PARAMETER NoProtocols is NULL. + @retval EFI_INVALID_PARAMETER Buffer is NULL. + +**/ +EFI_STATUS +EFIAPI +EfiLocateProtocolBuffer ( + IN EFI_GUID *Protocol, + OUT UINTN *NoProtocols, + OUT VOID ***Buffer + ) +{ + EFI_STATUS Status; + UINTN NoHandles; + EFI_HANDLE *HandleBuffer; + UINTN Index; + + // + // Check input parameters + // + if (Protocol =3D=3D NULL || NoProtocols =3D=3D NULL || Buffer =3D=3D NUL= L) { + return EFI_INVALID_PARAMETER; + } + + // + // Initialze output parameters + // + *NoProtocols =3D 0; + *Buffer =3D NULL; + + // + // Retrieve the array of handles that support Protocol + // + Status =3D gBS->LocateHandleBuffer ( + ByProtocol, + Protocol, + NULL, + &NoHandles, + &HandleBuffer + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Allocate array of protocol instances + // + Status =3D gBS->AllocatePool ( + EfiBootServicesData, + NoHandles * sizeof (VOID *), + (VOID **)Buffer + ); + if (EFI_ERROR (Status)) { + return EFI_OUT_OF_RESOURCES; + } + ZeroMem (*Buffer, NoHandles * sizeof (VOID *)); + + // + // Lookup Protocol on each handle in HandleBuffer to fill in the array of + // protocol instances. Handle case where protocol instance was present = when + // LocateHandleBuffer() was called, but is not present when HandleProtoc= ol() + // is called. + // + for (Index =3D 0, *NoProtocols =3D 0; Index < NoHandles; Index++) { + Status =3D gBS->HandleProtocol ( + HandleBuffer[Index], + Protocol, + &((*Buffer)[*NoProtocols]) + ); + if (!EFI_ERROR (Status)) { + (*NoProtocols)++; + } + } + + // + // Free the handle buffer + // + gBS->FreePool (HandleBuffer); + + // + // Make sure at least one protocol instance was found + // + if (*NoProtocols =3D=3D 0) { + gBS->FreePool (*Buffer); + *Buffer =3D NULL; + return EFI_NOT_FOUND; + } + + return EFI_SUCCESS; +} --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Dec 23 09:57:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1517620008976524.8171591861911; Fri, 2 Feb 2018 17:06:48 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 302E421D2BF08; Fri, 2 Feb 2018 17:01:07 -0800 (PST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CC3442237A4CE for ; Fri, 2 Feb 2018 17:01:04 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 17:06:42 -0800 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.254.102.40]) by fmsmga006.fm.intel.com with ESMTP; 02 Feb 2018 17:06:42 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,452,1511856000"; d="scan'208";a="200986004" From: "Kinney, Michael D" To: edk2-devel@lists.01.org Date: Fri, 2 Feb 2018 17:06:36 -0800 Message-Id: <20180203010638.22220-3-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20180203010638.22220-1-michael.d.kinney@intel.com> References: <20180203010638.22220-1-michael.d.kinney@intel.com> Subject: [edk2] [Patch V2 2/3] IntelFrameworkPkg/FrameworkUefiLib: Add EfiLocateProtocolBuffer() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney , Jiewen Yao , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D838 Add new API to the UefiLib that locates and returns an array of protocols instances that match a given protocol. Cc: Sean Brogan Cc: Jiewen Yao Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney Reviewed-By: Bret Barkelew Bret.Barkelew@microsoft.com Reviewed-by: Star Zeng to the patch series. --- .../Library/FrameworkUefiLib/UefiLib.c | 112 +++++++++++++++++= +++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/IntelFr= ameworkPkg/Library/FrameworkUefiLib/UefiLib.c index 30b6dc9218..845f6ea173 100644 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c +++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c @@ -5,7 +5,7 @@ EFI Driver Model related protocols, manage Unicode string tables for UEF= I Drivers,=20 and print messages on the console output and standard error devices. =20 - Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -1475,3 +1475,113 @@ GetBestLanguage ( // return NULL; } + +/** + Returns an array of protocol instance that matches the given protocol. + + @param[in] Protocol Provides the protocol to search for. + @param[out] NoProtocols The number of protocols returned in Buffer. + @param[out] Buffer A pointer to the buffer to return the requested + array of protocol instances that match Protoco= l. + The returned buffer is allocated using + EFI_BOOT_SERVICES.AllocatePool(). The caller = is + responsible for freeing this buffer with + EFI_BOOT_SERVICES.FreePool(). + + @retval EFI_SUCCESS The array of protocols was returned in Bu= ffer, + and the number of protocols in Buffer was + returned in NoProtocols. + @retval EFI_NOT_FOUND No protocols found. + @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store = the + matching results. + @retval EFI_INVALID_PARAMETER Protocol is NULL. + @retval EFI_INVALID_PARAMETER NoProtocols is NULL. + @retval EFI_INVALID_PARAMETER Buffer is NULL. + +**/ +EFI_STATUS +EFIAPI +EfiLocateProtocolBuffer ( + IN EFI_GUID *Protocol, + OUT UINTN *NoProtocols, + OUT VOID ***Buffer + ) +{ + EFI_STATUS Status; + UINTN NoHandles; + EFI_HANDLE *HandleBuffer; + UINTN Index; + + // + // Check input parameters + // + if (Protocol =3D=3D NULL || NoProtocols =3D=3D NULL || Buffer =3D=3D NUL= L) { + return EFI_INVALID_PARAMETER; + } + + // + // Initialze output parameters + // + *NoProtocols =3D 0; + *Buffer =3D NULL; + + // + // Retrieve the array of handles that support Protocol + // + Status =3D gBS->LocateHandleBuffer ( + ByProtocol, + Protocol, + NULL, + &NoHandles, + &HandleBuffer + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Allocate array of protocol instances + // + Status =3D gBS->AllocatePool ( + EfiBootServicesData, + NoHandles * sizeof (VOID *), + (VOID **)Buffer + ); + if (EFI_ERROR (Status)) { + return EFI_OUT_OF_RESOURCES; + } + ZeroMem (*Buffer, NoHandles * sizeof (VOID *)); + + // + // Lookup Protocol on each handle in HandleBuffer to fill in the array of + // protocol instances. Handle case where protocol instance was present = when + // LocateHandleBuffer() was called, but is not present when HandleProtoc= ol() + // is called. + // + for (Index =3D 0, *NoProtocols =3D 0; Index < NoHandles; Index++) { + Status =3D gBS->HandleProtocol ( + HandleBuffer[Index], + Protocol, + &((*Buffer)[*NoProtocols]) + ); + if (!EFI_ERROR (Status)) { + (*NoProtocols)++; + } + } + + // + // Free the handle buffer + // + gBS->FreePool (HandleBuffer); + + // + // Make sure at least one protocol instance was found + // + if (*NoProtocols =3D=3D 0) { + gBS->FreePool (*Buffer); + *Buffer =3D NULL; + return EFI_NOT_FOUND; + } + + return EFI_SUCCESS; +} --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Dec 23 09:57:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1517620011656160.0285107797106; Fri, 2 Feb 2018 17:06:51 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8878221E0B9EA; Fri, 2 Feb 2018 17:01:07 -0800 (PST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3A9D62237A4FC for ; Fri, 2 Feb 2018 17:01:05 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 17:06:43 -0800 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.254.102.40]) by fmsmga006.fm.intel.com with ESMTP; 02 Feb 2018 17:06:42 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,452,1511856000"; d="scan'208";a="200986010" From: "Kinney, Michael D" To: edk2-devel@lists.01.org Date: Fri, 2 Feb 2018 17:06:37 -0800 Message-Id: <20180203010638.22220-4-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20180203010638.22220-1-michael.d.kinney@intel.com> References: <20180203010638.22220-1-michael.d.kinney@intel.com> Subject: [edk2] [Patch V2 3/3] IntelFrameworkPkg/FrameworkUefiLib: Sync with MdePkg/UefiLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney , Jiewen Yao , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add functions that have been added to MdePkg/UefiLib. * GetVariable2() * GetEfiGlobalVariable2 Cc: Sean Brogan Cc: Jiewen Yao Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney Reviewed-By: Bret Barkelew Bret.Barkelew@microsoft.com Reviewed-by: Star Zeng to the patch series. --- .../Library/FrameworkUefiLib/UefiLib.c | 102 +++++++++++++++++= ++++ 1 file changed, 102 insertions(+) diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/IntelFr= ameworkPkg/Library/FrameworkUefiLib/UefiLib.c index 845f6ea173..895ff39fc1 100644 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c +++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c @@ -1338,6 +1338,108 @@ GetEfiGlobalVariable ( return GetVariable (Name, &gEfiGlobalVariableGuid); } =20 +/** + Returns the status whether get the variable success. The function retrie= ves + variable through the UEFI Runtime Service GetVariable(). The + returned buffer is allocated using AllocatePool(). The caller is respon= sible + for freeing this buffer with FreePool(). + + If Name is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + If Value is NULL, then ASSERT(). + + @param[in] Name The pointer to a Null-terminated Unicode string. + @param[in] Guid The pointer to an EFI_GUID structure + @param[out] Value The buffer point saved the variable info. + @param[out] Size The buffer size of the variable. + + @return EFI_OUT_OF_RESOURCES Allocate buffer failed. + @return EFI_SUCCESS Find the specified variable. + @return Others Errors Return errors from call to gRT->GetVar= iable. + +**/ +EFI_STATUS +EFIAPI +GetVariable2 ( + IN CONST CHAR16 *Name, + IN CONST EFI_GUID *Guid, + OUT VOID **Value, + OUT UINTN *Size OPTIONAL + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + + ASSERT (Name !=3D NULL && Guid !=3D NULL && Value !=3D NULL); + + // + // Try to get the variable size. + // + BufferSize =3D 0; + *Value =3D NULL; + if (Size !=3D NULL) { + *Size =3D 0; + } + + Status =3D gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &= BufferSize, *Value); + if (Status !=3D EFI_BUFFER_TOO_SMALL) { + return Status; + } + + // + // Allocate buffer to get the variable. + // + *Value =3D AllocatePool (BufferSize); + ASSERT (*Value !=3D NULL); + if (*Value =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // Get the variable data. + // + Status =3D gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &= BufferSize, *Value); + if (EFI_ERROR (Status)) { + FreePool(*Value); + *Value =3D NULL; + } + + if (Size !=3D NULL) { + *Size =3D BufferSize; + } + + return Status; +} + +/** + Returns a pointer to an allocated buffer that contains the contents of a + variable retrieved through the UEFI Runtime Service GetVariable(). This + function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. + The returned buffer is allocated using AllocatePool(). The caller is + responsible for freeing this buffer with FreePool(). + + If Name is NULL, then ASSERT(). + If Value is NULL, then ASSERT(). + + @param[in] Name The pointer to a Null-terminated Unicode string. + @param[out] Value The buffer point saved the variable info. + @param[out] Size The buffer size of the variable. + + @return EFI_OUT_OF_RESOURCES Allocate buffer failed. + @return EFI_SUCCESS Find the specified variable. + @return Others Errors Return errors from call to gRT->GetVar= iable. + +**/ +EFI_STATUS +EFIAPI +GetEfiGlobalVariable2 ( + IN CONST CHAR16 *Name, + OUT VOID **Value, + OUT UINTN *Size OPTIONAL + ) +{ + return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size); +} =20 /** Returns a pointer to an allocated buffer that contains the best matching= language=20 --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel