From nobody Fri Dec 27 02:56:08 2024 Delivered-To: importer@patchew.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; 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 1503072073620858.4031802160258; Fri, 18 Aug 2017 09:01:13 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DA8A221CFA604; Fri, 18 Aug 2017 08:58:37 -0700 (PDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 7E7E12095B9D7 for ; Fri, 18 Aug 2017 08:58:36 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Aug 2017 09:00:50 -0700 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.22]) by orsmga003.jf.intel.com with ESMTP; 18 Aug 2017 09:00:49 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,393,1498546800"; d="scan'208";a="1005243116" From: Star Zeng To: edk2-devel@lists.01.org Date: Sat, 19 Aug 2017 00:00:35 +0800 Message-Id: <1503072038-134760-3-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 In-Reply-To: <1503072038-134760-1-git-send-email-star.zeng@intel.com> References: <1503072038-134760-1-git-send-email-star.zeng@intel.com> Subject: [edk2] [PATCH 2/5] MdePkg PeiServicesLib: Add PeiServicesFreePages X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao , Star Zeng 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 PeiServicesFreePages and update comments for PeiServicesAllocatePages. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- MdePkg/Include/Library/PeiServicesLib.h | 31 ++++++++++++++++++----- MdePkg/Library/PeiServicesLib/PeiServicesLib.c | 35 ++++++++++++++++++++++= ---- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/MdePkg/Include/Library/PeiServicesLib.h b/MdePkg/Include/Libra= ry/PeiServicesLib.h index 2b51d374c9b4..9fc22a10c178 100644 --- a/MdePkg/Include/Library/PeiServicesLib.h +++ b/MdePkg/Include/Library/PeiServicesLib.h @@ -1,7 +1,7 @@ /** @file Provides library functions for all PEI Services. =20 -Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
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 @@ -264,16 +264,16 @@ PeiServicesInstallPeiMemory ( ); =20 /** - This service enables PEIMs to allocate memory after the permanent memory= has been installed by a - PEIM. + This service enables PEIMs to allocate memory. =20 @param MemoryType Type of memory to allocate. - @param Pages Number of pages to allocate. + @param Pages The number of pages to allocate. @param Memory Pointer of memory allocated. =20 @retval EFI_SUCCESS The memory range was successfully allocate= d. - @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages. - @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available. + @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoa= derData, EfiRuntimeServicesCode, + EfiRuntimeServicesData, EfiBootServicesCod= e, EfiBootServicesData, + EfiACPIReclaimMemory, EfiReservedMemoryTyp= e, or EfiACPIMemoryNVS. @retval EFI_OUT_OF_RESOURCES The pages could not be allocated. =20 **/ @@ -286,6 +286,25 @@ PeiServicesAllocatePages ( ); =20 /** + This service enables PEIMs to free memory. + + @param Memory Memory to be freed. + @param Pages The number of pages to free. + + @retval EFI_SUCCESS The requested pages were freed. + @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pa= ges is invalid. + @retval EFI_NOT_FOUND The requested memory pages were not alloca= ted with + AllocatePages(). + +**/ +EFI_STATUS +EFIAPI +PeiServicesFreePages ( + IN EFI_PHYSICAL_ADDRESS Memory, + IN UINTN Pages + ); + +/** This service allocates memory from the Hand-Off Block (HOB) heap. =20 @param Size The number of bytes to allocate from the p= ool. diff --git a/MdePkg/Library/PeiServicesLib/PeiServicesLib.c b/MdePkg/Librar= y/PeiServicesLib/PeiServicesLib.c index cb303f083f0d..89166ccd38c3 100644 --- a/MdePkg/Library/PeiServicesLib/PeiServicesLib.c +++ b/MdePkg/Library/PeiServicesLib/PeiServicesLib.c @@ -1,7 +1,7 @@ /** @file Implementation for PEI Services Library. =20 - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2017, 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 @@ -357,16 +357,16 @@ PeiServicesInstallPeiMemory ( } =20 /** - This service enables PEIMs to allocate memory after the permanent memory= has been - installed by a PEIM. + This service enables PEIMs to allocate memory. =20 @param MemoryType Type of memory to allocate. @param Pages The number of pages to allocate. @param Memory Pointer of memory allocated. =20 @retval EFI_SUCCESS The memory range was successfully allocate= d. - @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages. - @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available. + @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoa= derData, EfiRuntimeServicesCode, + EfiRuntimeServicesData, EfiBootServicesCod= e, EfiBootServicesData, + EfiACPIReclaimMemory, EfiReservedMemoryTyp= e, or EfiACPIMemoryNVS. @retval EFI_OUT_OF_RESOURCES The pages could not be allocated. =20 **/ @@ -385,6 +385,31 @@ PeiServicesAllocatePages ( } =20 /** + This service enables PEIMs to free memory. + + @param Memory Memory to be freed. + @param Pages The number of pages to free. + + @retval EFI_SUCCESS The requested pages were freed. + @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pa= ges is invalid. + @retval EFI_NOT_FOUND The requested memory pages were not alloca= ted with + AllocatePages(). + +**/ +EFI_STATUS +EFIAPI +PeiServicesFreePages ( + IN EFI_PHYSICAL_ADDRESS Memory, + IN UINTN Pages + ) +{ + CONST EFI_PEI_SERVICES **PeiServices; + + PeiServices =3D GetPeiServicesTablePointer (); + return (*PeiServices)->FreePages (PeiServices, Memory, Pages); +} + +/** This service allocates memory from the Hand-Off Block (HOB) heap. =20 @param Size The number of bytes to allocate from the p= ool. --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel