From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web11.2463.1629575784425973302 for ; Sat, 21 Aug 2021 12:56:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=oGD22T0U; spf=pass (domain: posteo.de, ip: 185.67.36.65, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id D5EC0240028 for ; Sat, 21 Aug 2021 21:56:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1629575782; bh=QuYK6Dh7Av36UU2ucgkIxzROIn7vi51OzCSLXSNBMf0=; h=From:To:Cc:Subject:Date:From; b=oGD22T0URK8qnMsY4MYA9z9v694WsL42TJvwloou1TKTrHUSnT1GqmUQWwbz8Rjvi eR1IDqOKzZ+mfenMz/Txu5SuP8Hs5OBRhgmTTgxGQBjMt/kT2h7rBjYvmsYvKeblMk NeLsfTcfkcXOHT5mwAjmKmDC9PDZbILpxm+o07SmDEleibeEe3J+NLXUiDjfIua+Lp HlvzE7DBaW+OKJOLlcACxnih0B05lI8Ia+m99M4+UDHjo3Rsk0Z1KHfLrQxH0xbdKr SSlek74qpWqWZqfra2hP7EPQPpovovgs+Vfyx0FIEXQ5IjA2+iuBwHlPzmWmpqeSdq dFvh4//trVNwg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GsTlp28Ypz9rxM; Sat, 21 Aug 2021 21:56:22 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Eric Dong , Ray Ni , Vitaly Cheptsov Subject: [PATCH 1/1] MdeModulePkg: Move PiSmmCoreMemoryAllocationLib into PiSmmCore Date: Sat, 21 Aug 2021 19:55:46 +0000 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable PiSmmCoreMemoryAllocationLib duplicates private definitions of PiSmmCore, namely the SMM_CORE_PRIVATE_DATA structure. Move this code into PiSmmCore, so that the struct definition can be consumed directly instead. Cc: Jian J Wang Cc: Hao A Wu Cc: Eric Dong Cc: Ray Ni Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- MdeModulePkg/{Library/PiSmmCoreMemoryAllocationLib/MemoryAllocationLib.c = =3D> Core/PiSmmCore/MemoryAllocation.c} | 3 +- MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf = | 1 + MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocatio= nLib.inf | 5 +- MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocatio= nProfileLib.inf | 6 +- MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocatio= nServices.h | 185 -------------------- 5 files changed, 10 insertions(+), 190 deletions(-) diff --git a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/MemoryAlloca= tionLib.c b/MdeModulePkg/Core/PiSmmCore/MemoryAllocation.c similarity index 96% rename from MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/MemoryAllocat= ionLib.c rename to MdeModulePkg/Core/PiSmmCore/MemoryAllocation.c index fd20a779cdcc..fb99174c9d8d 100644 --- a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/MemoryAllocationLib= .c +++ b/MdeModulePkg/Core/PiSmmCore/MemoryAllocation.c @@ -22,7 +22,8 @@ #include =0D #include =0D #include =0D -#include "PiSmmCoreMemoryAllocationServices.h"=0D +#include "PiSmmCore.h"=0D +#include "PiSmmCorePrivateData.h"=0D =0D #include =0D =0D diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf b/MdeModulePkg/Core/= PiSmmCore/PiSmmCore.inf index c8bfae3860fc..85628f927134 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf @@ -37,6 +37,7 @@ [Sources] SmiHandlerProfile.c=0D HeapGuard.c=0D HeapGuard.h=0D + MemoryAllocation.c=0D =0D [Packages]=0D MdePkg/MdePkg.dec=0D diff --git a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMem= oryAllocationLib.inf b/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/Pi= SmmCoreMemoryAllocationLib.inf index 5c51c48b0b1e..8812c9604103 100644 --- a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationLib.inf +++ b/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationLib.inf @@ -19,6 +19,9 @@ [Defines] VERSION_STRING =3D 1.0=0D PI_SPECIFICATION_VERSION =3D 0x0001000A=0D LIBRARY_CLASS =3D MemoryAllocationLib|SMM_CORE=0D + #=0D + # This function is defined in PiSmmCore.=0D + #=0D CONSTRUCTOR =3D PiSmmCoreMemoryAllocationLibConstruct= or=0D =0D #=0D @@ -28,8 +31,6 @@ [Defines] #=0D =0D [Sources]=0D - MemoryAllocationLib.c=0D - PiSmmCoreMemoryAllocationServices.h=0D PiSmmCoreMemoryProfileLibNull.c=0D =0D [Packages]=0D diff --git a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMem= oryAllocationProfileLib.inf b/MdeModulePkg/Library/PiSmmCoreMemoryAllocatio= nLib/PiSmmCoreMemoryAllocationProfileLib.inf index 89658c0f6ccb..c3b8a4fdce7b 100644 --- a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationProfileLib.inf +++ b/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationProfileLib.inf @@ -19,6 +19,9 @@ [Defines] VERSION_STRING =3D 1.0=0D PI_SPECIFICATION_VERSION =3D 0x0001000A=0D LIBRARY_CLASS =3D MemoryAllocationLib|SMM_CORE=0D + #=0D + # This function is defined in PiSmmCore.=0D + #=0D CONSTRUCTOR =3D PiSmmCoreMemoryAllocationLibConstruct= or=0D LIBRARY_CLASS =3D MemoryProfileLib|SMM_CORE=0D CONSTRUCTOR =3D PiSmmCoreMemoryProfileLibConstructor= =0D @@ -30,8 +33,6 @@ [Defines] #=0D =0D [Sources]=0D - MemoryAllocationLib.c=0D - PiSmmCoreMemoryAllocationServices.h=0D PiSmmCoreMemoryProfileLib.c=0D PiSmmCoreMemoryProfileServices.h=0D =0D @@ -43,6 +44,7 @@ [LibraryClasses] DebugLib=0D BaseMemoryLib=0D UefiBootServicesTableLib=0D + MemoryAllocationLib=0D =0D [Guids]=0D gEdkiiMemoryProfileGuid ## SOMETIMES_CONSUMES ## GUID # Locate proto= col=0D diff --git a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMem= oryAllocationServices.h b/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib= /PiSmmCoreMemoryAllocationServices.h deleted file mode 100644 index 789fcf2c01ea..000000000000 --- a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationServices.h +++ /dev/null @@ -1,185 +0,0 @@ -/** @file=0D - Contains function prototypes for Memory Services in the SMM Core.=0D -=0D - This header file borrows the PiSmmCore Memory Allocation services as the= primitive=0D - for memory allocation.=0D -=0D - Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
=0D - SPDX-License-Identifier: BSD-2-Clause-Patent=0D -=0D -**/=0D -=0D -#ifndef _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_=0D -#define _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_=0D -=0D -//=0D -// It should be aligned with the definition in PiSmmCore.=0D -//=0D -typedef struct {=0D - UINTN Signature;=0D -=0D - ///=0D - /// The ImageHandle passed into the entry point of the SMM IPL. This Im= ageHandle=0D - /// is used by the SMM Core to fill in the ParentImageHandle field of th= e Loaded=0D - /// Image Protocol for each SMM Driver that is dispatched by the SMM Cor= e.=0D - ///=0D - EFI_HANDLE SmmIplImageHandle;=0D -=0D - ///=0D - /// The number of SMRAM ranges passed from the SMM IPL to the SMM Core. = The SMM=0D - /// Core uses these ranges of SMRAM to initialize the SMM Core memory ma= nager.=0D - ///=0D - UINTN SmramRangeCount;=0D -=0D - ///=0D - /// A table of SMRAM ranges passed from the SMM IPL to the SMM Core. Th= e SMM=0D - /// Core uses these ranges of SMRAM to initialize the SMM Core memory ma= nager.=0D - ///=0D - EFI_SMRAM_DESCRIPTOR *SmramRanges;=0D -=0D - ///=0D - /// The SMM Foundation Entry Point. The SMM Core fills in this field wh= en the=0D - /// SMM Core is initialized. The SMM IPL is responsbile for registering= this entry=0D - /// point with the SMM Configuration Protocol. The SMM Configuration Pr= otocol may=0D - /// not be available at the time the SMM IPL and SMM Core are started, s= o the SMM IPL=0D - /// sets up a protocol notification on the SMM Configuration Protocol an= d registers=0D - /// the SMM Foundation Entry Point as soon as the SMM Configuration Prot= ocol is=0D - /// available.=0D - ///=0D - EFI_SMM_ENTRY_POINT SmmEntryPoint;=0D -=0D - ///=0D - /// Boolean flag set to TRUE while an SMI is being processed by the SMM = Core.=0D - ///=0D - BOOLEAN SmmEntryPointRegistered;=0D -=0D - ///=0D - /// Boolean flag set to TRUE while an SMI is being processed by the SMM = Core.=0D - ///=0D - BOOLEAN InSmm;=0D -=0D - ///=0D - /// This field is set by the SMM Core then the SMM Core is initialized. = This field is=0D - /// used by the SMM Base 2 Protocol and SMM Communication Protocol imple= mentations in=0D - /// the SMM IPL.=0D - ///=0D - EFI_SMM_SYSTEM_TABLE2 *Smst;=0D -=0D - ///=0D - /// This field is used by the SMM Communicatioon Protocol to pass a buff= er into=0D - /// a software SMI handler and for the software SMI handler to pass a bu= ffer back to=0D - /// the caller of the SMM Communication Protocol.=0D - ///=0D - VOID *CommunicationBuffer;=0D -=0D - ///=0D - /// This field is used by the SMM Communicatioon Protocol to pass the si= ze of a buffer,=0D - /// in bytes, into a software SMI handler and for the software SMI handl= er to pass the=0D - /// size, in bytes, of a buffer back to the caller of the SMM Communicat= ion Protocol.=0D - ///=0D - UINTN BufferSize;=0D -=0D - ///=0D - /// This field is used by the SMM Communication Protocol to pass the ret= urn status from=0D - /// a software SMI handler back to the caller of the SMM Communication P= rotocol.=0D - ///=0D - EFI_STATUS ReturnStatus;=0D -=0D - EFI_PHYSICAL_ADDRESS PiSmmCoreImageBase;=0D - UINT64 PiSmmCoreImageSize;=0D - EFI_PHYSICAL_ADDRESS PiSmmCoreEntryPoint;=0D -} SMM_CORE_PRIVATE_DATA;=0D -=0D -/**=0D - Called to initialize the memory service.=0D -=0D - @param SmramRangeCount Number of SMRAM Regions=0D - @param SmramRanges Pointer to SMRAM Descriptors=0D -=0D -**/=0D -VOID=0D -SmmInitializeMemoryServices (=0D - IN UINTN SmramRangeCount,=0D - IN EFI_SMRAM_DESCRIPTOR *SmramRanges=0D - );=0D -=0D -/**=0D - Allocates pages from the memory map.=0D -=0D - @param Type The type of allocation to perform=0D - @param MemoryType The type of memory to turn the allocated = pages=0D - into=0D - @param NumberOfPages The number of pages to allocate=0D - @param Memory A pointer to receive the base allocated m= emory=0D - address=0D -=0D - @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined= in spec.=0D - @retval EFI_NOT_FOUND Could not allocate pages match the requir= ement.=0D - @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.=0D - @retval EFI_SUCCESS Pages successfully allocated.=0D -=0D -**/=0D -EFI_STATUS=0D -EFIAPI=0D -SmmAllocatePages (=0D - IN EFI_ALLOCATE_TYPE Type,=0D - IN EFI_MEMORY_TYPE MemoryType,=0D - IN UINTN NumberOfPages,=0D - OUT EFI_PHYSICAL_ADDRESS *Memory=0D - );=0D -=0D -/**=0D - Frees previous allocated pages.=0D -=0D - @param Memory Base address of memory being freed=0D - @param NumberOfPages The number of pages to free=0D -=0D - @retval EFI_NOT_FOUND Could not find the entry that covers the = range=0D - @retval EFI_INVALID_PARAMETER Address not aligned=0D - @return EFI_SUCCESS Pages successfully freed.=0D -=0D -**/=0D -EFI_STATUS=0D -EFIAPI=0D -SmmFreePages (=0D - IN EFI_PHYSICAL_ADDRESS Memory,=0D - IN UINTN NumberOfPages=0D - );=0D -=0D -/**=0D - Allocate pool of a particular type.=0D -=0D - @param PoolType Type of pool to allocate=0D - @param Size The amount of pool to allocate=0D - @param Buffer The address to return a pointer to the al= located=0D - pool=0D -=0D - @retval EFI_INVALID_PARAMETER PoolType not valid=0D - @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation = failed.=0D - @retval EFI_SUCCESS Pool successfully allocated.=0D -=0D -**/=0D -EFI_STATUS=0D -EFIAPI=0D -SmmAllocatePool (=0D - IN EFI_MEMORY_TYPE PoolType,=0D - IN UINTN Size,=0D - OUT VOID **Buffer=0D - );=0D -=0D -/**=0D - Frees pool.=0D -=0D - @param Buffer The allocated pool entry to free=0D -=0D - @retval EFI_INVALID_PARAMETER Buffer is not a valid value.=0D - @retval EFI_SUCCESS Pool successfully freed.=0D -=0D -**/=0D -EFI_STATUS=0D -EFIAPI=0D -SmmFreePool (=0D - IN VOID *Buffer=0D - );=0D -=0D -#endif=0D --=20 2.31.1