From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sonic315-14.consmr.mail.bf2.yahoo.com (sonic315-14.consmr.mail.bf2.yahoo.com [74.6.134.124]) by mx.groups.io with SMTP id smtpd.web09.2612.1616618018838556216 for ; Wed, 24 Mar 2021 13:33:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=KJMbxYBs; spf=neutral (domain: yahoo.com, ip: 74.6.134.124, mailfrom: shedvll@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1616618018; bh=mvCd0bofWJ+oJUtJyYroGKkkzJmlKDqC7w+9LPHWUR8=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To; b=KJMbxYBsxXR4PkwwQdHLhUYGGFDLgdvr0nIw8ctdy1YmEnbQ+aBFDOvmlcl2Qh+cSNaFgsE/OlGKrYo03jRDDx4EA//xBdu0Jc5v1Hf1vDzM+KwheJUiPrjvYMkgUg3xb+1wgM9Jo0sDUagRhNPs5vLUAiSnkyp8xBDgERsO0/P1F5gGSEHVoASqGV8PVP3tNrjvq9tb+YIC9UblVbr+W8GFfvEShjG9MzCPh9IQtYKxB+LYX/vzlvKSPtoHKpRCk+9PZ4Zgw60g1lfZu8VVgSKu1k/a9pdWL57PzHxjkuVIGKS4w1ZSoCFGKGqFOPPEqUl90sNhWKfq0u+1LxtrAw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1616618018; bh=MvC7YGmBiXM3OmO/+0SpewnhqjWJKKj5+yV+td625wF=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=P7lk4KNkdDGOQ1+F5nszQ96rvIJGwZgOoQ4lbEYh/UvIrt5ma2fqASP0t3ticSo7CWC5nLk5CDWzUkN2ETNg7T4b9If1lm0dx0P/aHZL23Ua93B5WimAgIKM3YA30ey/VAcxB3bHeQexds/mVx5i7u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: Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.bf2.yahoo.com with HTTP; Wed, 24 Mar 2021 20:33:38 +0000 Date: Wed, 24 Mar 2021 20:33:30 +0000 (UTC) From: Dawn Reply-To: Dawn To: devel@edk2.groups.io, jiewen.yao@intel.com, "Yao, Jiewen" , Kun Qin , "devel@edk2.groups.io" Cc: Ard Biesheuvel , Sami Mujawar , Supreeth Venkatesh Message-ID: <1027562214.3043619.1616618010539@mail.yahoo.com> In-Reply-To: References: <20201218185011.1366-1-kun.q@outlook.com> Subject: Re: [edk2-devel] [PATCH v1 02/15] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core MIME-Version: 1.0 X-Mailer: WebService/1.1.17936 YahooMailAndroidMobile YMobile/1.0 (com.yahoo.mobile.client.android.mail/6.21.1; Android/10; QP1A.190711.020; a11q; samsung; SM-A115AZ; 4.95; 1411x720;) Content-Type: multipart/alternative; boundary="----=_Part_3043618_24503051.1616618010532" ------=_Part_3043618_24503051.1616618010532 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Importing spamReporting=C2=A0Tracking successful=C2=A0 On Fri, Mar 12, 2021 at 4:46 AM, Yao, Jiewen wrote= : Can we merge the common part between X64 and AArch64 into one Common.c? > -----Original Message----- > From: Kun Qin > Sent: Saturday, December 19, 2020 2:50 AM > To: devel@edk2.groups.io > Cc: Ard Biesheuvel ; Sami Mujawar > ; Yao, Jiewen ; Supreeth > Venkatesh > Subject: [PATCH v1 02/15] StandaloneMmPkg: StandaloneMmCoreHobLib: > Extend support for x64 Mm Core >=20 > This change adds support of x64 version of StandaloneMmCoreHobLib. It > brings in global variable "gHobList" through StandaloneMmCoreEntryPoint > and imports implementation from DxeCoreHobLib.inf to support x64 Mm > Core. >=20 > Cc: Ard Biesheuvel > Cc: Sami Mujawar > Cc: Jiewen Yao > Cc: Supreeth Venkatesh >=20 > Signed-off-by: Kun Qin > --- >=C2=A0 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =3D> > AArch64}/StandaloneMmCoreHobLib.c |=C2=A0 6 +- >=C2=A0 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =3D> > X64}/StandaloneMmCoreHobLib.c=C2=A0 =C2=A0 | 426 ++++++++++---------- >=20 > StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore > HobLib.inf=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 8 +- >=C2=A0 3 files changed, 215 insertions(+), 225 deletions(-) >=20 > diff --git > a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo > reHobLib.c > b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standal > oneMmCoreHobLib.c > similarity index 96% > copy from > StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore > HobLib.c > copy to > StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standalon > eMmCoreHobLib.c > index e3d4743b63f2..006bff816e39 100644 > --- > a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo > reHobLib.c > +++ > b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standal > oneMmCoreHobLib.c > @@ -13,14 +13,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >=C2=A0 #include >=C2=A0 #include >=C2=A0 #include > +#include >=20 >=C2=A0 #include >=20 > -// > -// Cache copy of HobList pointer. > -// > -VOID *gHobList =3D NULL; > - >=C2=A0 /** >=C2=A0 =C2=A0 Returns the pointer to the HOB list. >=20 > diff --git > a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo > reHobLib.c > b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standalone > MmCoreHobLib.c > similarity index 70% > rename from > StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore > HobLib.c > rename to > StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneM > mCoreHobLib.c > index e3d4743b63f2..69b20bf07a21 100644 > --- > a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo > reHobLib.c > +++ > b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standalone > MmCoreHobLib.c > @@ -13,14 +13,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >=C2=A0 #include >=C2=A0 #include >=C2=A0 #include > +#include >=20 >=C2=A0 #include >=20 > -// > -// Cache copy of HobList pointer. > -// > -VOID *gHobList =3D NULL; > - >=C2=A0 /** >=C2=A0 =C2=A0 Returns the pointer to the HOB list. >=20 > @@ -203,48 +199,13 @@ GetBootModeHob ( >=C2=A0 =C2=A0 return HandOffHob->BootMode; >=C2=A0 } >=20 > -VOID * > -CreateHob ( > -=C2=A0 IN=C2=A0 UINT16=C2=A0 =C2=A0 HobType, > -=C2=A0 IN=C2=A0 UINT16=C2=A0 =C2=A0 HobLength > -=C2=A0 ) > -{ > -=C2=A0 EFI_HOB_HANDOFF_INFO_TABLE=C2=A0 *HandOffHob; > -=C2=A0 EFI_HOB_GENERIC_HEADER=C2=A0 =C2=A0 =C2=A0 *HobEnd; > -=C2=A0 EFI_PHYSICAL_ADDRESS=C2=A0 =C2=A0 =C2=A0 =C2=A0 FreeMemory; > -=C2=A0 VOID=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 *Hob; > - > -=C2=A0 HandOffHob =3D GetHobList (); > - > -=C2=A0 HobLength =3D (UINT16)((HobLength + 0x7) & (~0x7)); > - > -=C2=A0 FreeMemory =3D HandOffHob->EfiFreeMemoryTop - HandOffHob- > >EfiFreeMemoryBottom; > - > -=C2=A0 if (FreeMemory < HobLength) { > -=C2=A0 =C2=A0 return NULL; > -=C2=A0 } > - > -=C2=A0 Hob =3D (VOID*) (UINTN) HandOffHob->EfiEndOfHobList; > -=C2=A0 ((EFI_HOB_GENERIC_HEADER*) Hob)->HobType =3D HobType; > -=C2=A0 ((EFI_HOB_GENERIC_HEADER*) Hob)->HobLength =3D HobLength; > -=C2=A0 ((EFI_HOB_GENERIC_HEADER*) Hob)->Reserved =3D 0; > - > -=C2=A0 HobEnd =3D (EFI_HOB_GENERIC_HEADER*) ((UINTN)Hob + HobLength); > -=C2=A0 HandOffHob->EfiEndOfHobList =3D (EFI_PHYSICAL_ADDRESS) (UINTN) > HobEnd; > - > -=C2=A0 HobEnd->HobType=C2=A0 =3D EFI_HOB_TYPE_END_OF_HOB_LIST; > -=C2=A0 HobEnd->HobLength =3D sizeof (EFI_HOB_GENERIC_HEADER); > -=C2=A0 HobEnd->Reserved=C2=A0 =3D 0; > -=C2=A0 HobEnd++; > -=C2=A0 HandOffHob->EfiFreeMemoryBottom =3D (EFI_PHYSICAL_ADDRESS) (UINT= N) > HobEnd; > - > -=C2=A0 return Hob; > -} > - >=C2=A0 /** >=C2=A0 =C2=A0 Builds a HOB for a loaded PE32 module. >=20 >=C2=A0 =C2=A0 This function builds a HOB for a loaded PE32 module. > +=C2=A0 It can only be invoked during PEI phase; > +=C2=A0 for MM phase, it will ASSERT() because PEI HOB is read-only for = MM > phase. > + >=C2=A0 =C2=A0 If ModuleName is NULL, then ASSERT(). >=C2=A0 =C2=A0 If there is no additional space for HOB creation, then ASSE= RT(). >=20 > @@ -263,31 +224,51 @@ BuildModuleHob ( >=C2=A0 =C2=A0 IN EFI_PHYSICAL_ADDRESS=C2=A0 EntryPoint >=C2=A0 =C2=A0 ) >=C2=A0 { > -=C2=A0 EFI_HOB_MEMORY_ALLOCATION_MODULE=C2=A0 *Hob; > +=C2=A0 // > +=C2=A0 // PEI HOB is read only for MM phase > +=C2=A0 // > +=C2=A0 ASSERT (FALSE); > +} >=20 > -=C2=A0 ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) =3D=3D 0= ) && > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((ModuleLength & (EFI_PAGE_SIZE - 1)= ) =3D=3D 0)); > +/** > +=C2=A0 Builds a HOB that describes a chunk of system memory with Owner = GUID. >=20 > -=C2=A0 Hob =3D CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof > (EFI_HOB_MEMORY_ALLOCATION_MODULE)); > +=C2=A0 This function builds a HOB that describes a chunk of system memo= ry. > +=C2=A0 It can only be invoked during PEI phase; > +=C2=A0 for MM phase, it will ASSERT() since PEI HOB is read-only for MM= phase. >=20 > -=C2=A0 CopyGuid (&(Hob->MemoryAllocationHeader.Name), > &gEfiHobMemoryAllocModuleGuid); > -=C2=A0 Hob->MemoryAllocationHeader.MemoryBaseAddress =3D > MemoryAllocationModule; > -=C2=A0 Hob->MemoryAllocationHeader.MemoryLength=C2=A0 =C2=A0 =C2=A0 =3D= ModuleLength; > -=C2=A0 Hob->MemoryAllocationHeader.MemoryType=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =3D EfiBootServicesCode; > +=C2=A0 If there is no additional space for HOB creation, then ASSERT(). >=20 > +=C2=A0 @param=C2=A0 ResourceType=C2=A0 =C2=A0 =C2=A0 =C2=A0 The type of= resource described by this HOB. > +=C2=A0 @param=C2=A0 ResourceAttribute=C2=A0 The resource attributes of = the memory > described by this HOB. > +=C2=A0 @param=C2=A0 PhysicalStart=C2=A0 =C2=A0 =C2=A0 The 64 bit physic= al address of memory > described by this HOB. > +=C2=A0 @param=C2=A0 NumberOfBytes=C2=A0 =C2=A0 =C2=A0 The length of the= memory described by this > HOB in bytes. > +=C2=A0 @param=C2=A0 OwnerGUID=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 GUID fo= r the owner of this resource. > + > +**/ > +VOID > +EFIAPI > +BuildResourceDescriptorWithOwnerHob ( > +=C2=A0 IN EFI_RESOURCE_TYPE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Re= sourceType, > +=C2=A0 IN EFI_RESOURCE_ATTRIBUTE_TYPE=C2=A0 ResourceAttribute, > +=C2=A0 IN EFI_PHYSICAL_ADDRESS=C2=A0 =C2=A0 =C2=A0 =C2=A0 PhysicalStart= , > +=C2=A0 IN UINT64=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 NumberOfBytes, > +=C2=A0 IN EFI_GUID=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 *OwnerGUID > +=C2=A0 ) > +{ >=C2=A0 =C2=A0 // > -=C2=A0 // Zero the reserved space to match HOB spec > +=C2=A0 // PEI HOB is read only for MM phase >=C2=A0 =C2=A0 // > -=C2=A0 ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob- > >MemoryAllocationHeader.Reserved)); > - > -=C2=A0 CopyGuid (&Hob->ModuleName, ModuleName); > -=C2=A0 Hob->EntryPoint =3D EntryPoint; > +=C2=A0 ASSERT (FALSE); >=C2=A0 } >=20 >=C2=A0 /** >=C2=A0 =C2=A0 Builds a HOB that describes a chunk of system memory. >=20 >=C2=A0 =C2=A0 This function builds a HOB that describes a chunk of system= memory. > +=C2=A0 It can only be invoked during PEI phase; > +=C2=A0 for MM phase, it will ASSERT() because PEI HOB is read-only for = MM > phase. > + >=C2=A0 =C2=A0 If there is no additional space for HOB creation, then ASSE= RT(). >=20 >=C2=A0 =C2=A0 @param=C2=A0 ResourceType=C2=A0 =C2=A0 =C2=A0 =C2=A0 The ty= pe of resource described by this HOB. > @@ -305,31 +286,32 @@ BuildResourceDescriptorHob ( >=C2=A0 =C2=A0 IN UINT64=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 NumberOfBytes >=C2=A0 =C2=A0 ) >=C2=A0 { > -=C2=A0 EFI_HOB_RESOURCE_DESCRIPTOR=C2=A0 *Hob; > - > -=C2=A0 Hob =3D CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof > (EFI_HOB_RESOURCE_DESCRIPTOR)); > -=C2=A0 ASSERT (Hob !=3D NULL); > - > -=C2=A0 Hob->ResourceType=C2=A0 =C2=A0 =C2=A0 =3D ResourceType; > -=C2=A0 Hob->ResourceAttribute =3D ResourceAttribute; > -=C2=A0 Hob->PhysicalStart=C2=A0 =C2=A0 =3D PhysicalStart; > -=C2=A0 Hob->ResourceLength=C2=A0 =C2=A0 =3D NumberOfBytes; > +=C2=A0 // > +=C2=A0 // PEI HOB is read only for MM phase > +=C2=A0 // > +=C2=A0 ASSERT (FALSE); >=C2=A0 } >=20 >=C2=A0 /** > -=C2=A0 Builds a GUID HOB with a certain data length. > +=C2=A0 Builds a customized HOB tagged with a GUID for identification an= d > returns > +=C2=A0 the start address of GUID HOB data. >=20 >=C2=A0 =C2=A0 This function builds a customized HOB tagged with a GUID fo= r > identification >=C2=A0 =C2=A0 and returns the start address of GUID HOB data so that call= er can fill the > customized data. >=C2=A0 =C2=A0 The HOB Header and Name field is already stripped. > +=C2=A0 It can only be invoked during PEI phase. > +=C2=A0 For MM phase, it will ASSERT() because PEI HOB is read-only for = MM > phase. > + >=C2=A0 =C2=A0 If Guid is NULL, then ASSERT(). >=C2=A0 =C2=A0 If there is no additional space for HOB creation, then ASSE= RT(). > -=C2=A0 If DataLength >=3D (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then = ASSERT(). > +=C2=A0 If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSE= RT(). > +=C2=A0 HobLength is UINT16 and multiples of 8 bytes, so the max HobLeng= th is > 0xFFF8. >=20 >=C2=A0 =C2=A0 @param=C2=A0 Guid=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 The GUI= D to tag the customized HOB. >=C2=A0 =C2=A0 @param=C2=A0 DataLength=C2=A0 =C2=A0 The size of the data p= ayload for the GUID HOB. >=20 > -=C2=A0 @return The start address of GUID HOB data. > +=C2=A0 @retval=C2=A0 NULL=C2=A0 =C2=A0 =C2=A0 =C2=A0 The GUID HOB could= not be allocated. > +=C2=A0 @retval=C2=A0 others=C2=A0 =C2=A0 =C2=A0 The start address of GU= ID HOB data. >=20 >=C2=A0 **/ >=C2=A0 VOID * > @@ -339,35 +321,36 @@ BuildGuidHob ( >=C2=A0 =C2=A0 IN UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 DataLength >=C2=A0 =C2=A0 ) >=C2=A0 { > -=C2=A0 EFI_HOB_GUID_TYPE *Hob; > - >=C2=A0 =C2=A0 // > -=C2=A0 // Make sure that data length is not too long. > +=C2=A0 // PEI HOB is read only for MM phase >=C2=A0 =C2=A0 // > -=C2=A0 ASSERT (DataLength <=3D (0xffff - sizeof (EFI_HOB_GUID_TYPE))); > - > -=C2=A0 Hob =3D CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof > (EFI_HOB_GUID_TYPE) + DataLength)); > -=C2=A0 CopyGuid (&Hob->Name, Guid); > -=C2=A0 return Hob + 1; > +=C2=A0 ASSERT (FALSE); > +=C2=A0 return NULL; >=C2=A0 } >=20 > - >=C2=A0 /** > -=C2=A0 Copies a data buffer to a newly-built HOB. > +=C2=A0 Builds a customized HOB tagged with a GUID for identification, c= opies the > input data to the HOB > +=C2=A0 data field, and returns the start address of the GUID HOB data. >=20 > -=C2=A0 This function builds a customized HOB tagged with a GUID for > identification, > -=C2=A0 copies the input data to the HOB data field and returns the star= t address > of the GUID HOB data. > +=C2=A0 This function builds a customized HOB tagged with a GUID for > identification and copies the input > +=C2=A0 data to the HOB data field and returns the start address of the = GUID HOB > data.=C2=A0 It can only be > +=C2=A0 invoked during PEI phase; for MM phase, it will ASSERT() because= PEI > HOB is read-only for MM phase. >=C2=A0 =C2=A0 The HOB Header and Name field is already stripped. > +=C2=A0 It can only be invoked during PEI phase. > +=C2=A0 For MM phase, it will ASSERT() because PEI HOB is read-only for = MM > phase. > + >=C2=A0 =C2=A0 If Guid is NULL, then ASSERT(). >=C2=A0 =C2=A0 If Data is NULL and DataLength > 0, then ASSERT(). >=C2=A0 =C2=A0 If there is no additional space for HOB creation, then ASSE= RT(). > -=C2=A0 If DataLength >=3D (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then = ASSERT(). > +=C2=A0 If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSE= RT(). > +=C2=A0 HobLength is UINT16 and multiples of 8 bytes, so the max HobLeng= th is > 0xFFF8. >=20 >=C2=A0 =C2=A0 @param=C2=A0 Guid=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 The GUI= D to tag the customized HOB. >=C2=A0 =C2=A0 @param=C2=A0 Data=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 The dat= a to be copied into the data field of the GUID > HOB. >=C2=A0 =C2=A0 @param=C2=A0 DataLength=C2=A0 =C2=A0 The size of the data p= ayload for the GUID HOB. >=20 > -=C2=A0 @return The start address of GUID HOB data. > +=C2=A0 @retval=C2=A0 NULL=C2=A0 =C2=A0 =C2=A0 =C2=A0 The GUID HOB could= not be allocated. > +=C2=A0 @retval=C2=A0 others=C2=A0 =C2=A0 =C2=A0 The start address of GU= ID HOB data. >=20 >=C2=A0 **/ >=C2=A0 VOID * > @@ -378,20 +361,22 @@ BuildGuidDataHob ( >=C2=A0 =C2=A0 IN UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 DataLength >=C2=A0 =C2=A0 ) >=C2=A0 { > -=C2=A0 VOID=C2=A0 *HobData; > - > -=C2=A0 ASSERT (Data !=3D NULL || DataLength =3D=3D 0); > - > -=C2=A0 HobData =3D BuildGuidHob (Guid, DataLength); > - > -=C2=A0 return CopyMem (HobData, Data, DataLength); > +=C2=A0 // > +=C2=A0 // PEI HOB is read only for MM phase > +=C2=A0 // > +=C2=A0 ASSERT (FALSE); > +=C2=A0 return NULL; >=C2=A0 } >=20 >=C2=A0 /** >=C2=A0 =C2=A0 Builds a Firmware Volume HOB. >=20 >=C2=A0 =C2=A0 This function builds a Firmware Volume HOB. > +=C2=A0 It can only be invoked during PEI phase; > +=C2=A0 for MM phase, it will ASSERT() because PEI HOB is read-only for = MM > phase. > + >=C2=A0 =C2=A0 If there is no additional space for HOB creation, then ASSE= RT(). > +=C2=A0 If the FvImage buffer is not at its required alignment, then ASS= ERT() ------=_Part_3043618_24503051.1616618010532 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Importing spam
Reportin= g 
Tracking = successful 


On Fri, M= ar 12, 2021 at 4:46 AM, Yao, Jiewen
<jiewen.yao@intel.com> = wrote:
Can we merge the comm= on part between X64 and AArch64 into one Common.c?

> -----Original Message-----
> From: Kun Qin <kun.q@outlook.com>
> Sent: Saturday, December 19, 2020 2:50 AM
= > Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>; Sami M= ujawar
> <sami.mujawar@arm.com>= ; Yao, Jiewen <jiewen.yao@intel.com>; Supreeth
> Venkatesh <supreeth.venkatesh@arm.com= >
> Subject: [PATCH v1 02/15] Standalon= eMmPkg: StandaloneMmCoreHobLib:
> Extend suppo= rt for x64 Mm Core
>
> This change adds support of x64 version of StandaloneMmCoreHobLib. I= t
> brings in global variable "gHobList" throu= gh StandaloneMmCoreEntryPoint
> and imports im= plementation from DxeCoreHobLib.inf to support x64 Mm
> Core.
>
&= gt; Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Cc: Sami Mujawar <sami.mujawar@arm.com&g= t;
> Cc: Jiewen Yao <jiewen.yao@intel.= com>
> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
&g= t;
> Signed-off-by: Kun Qin <kun.q@outlook.= com>
> ---
&g= t;  StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =3D>
=
> AArch64}/StandaloneMmCoreHobLib.c |  6 +-
>  StandaloneMmPkg/Library/StandaloneMmCoreHob= Lib/{ =3D>
> X64}/StandaloneMmCoreHobLib.c&= nbsp;   | 426 ++++++++++----------
>
> StandaloneMmPkg/Library/StandaloneMmCoreHobLib= /StandaloneMmCore
> HobLib.inf    &n= bsp;       |  8 +-
>&nbs= p; 3 files changed, 215 insertions(+), 225 deletions(-)
>
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneM= mCo
> reHobLib.c
>= ; b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standal
> oneMmCoreHobLib.c
> sim= ilarity index 96%
> copy from
> StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmC= ore
> HobLib.c
> = copy to
> StandaloneMmPkg/Library/StandaloneMm= CoreHobLib/AArch64/Standalon
> eMmCoreHobLib.c=
> index e3d4743b63f2..006bff816e39 100644
=
> ---
> a/Standalone= MmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo
> reHobLib.c
> +++
> b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standal<= br>
> oneMmCoreHobLib.c
= > @@ -13,14 +13,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include <Library/HobLib.h>
=
>  #include <Library/DebugLib.h>
>  #include <Library/BaseMemoryLib.h>
> +#include <Library/StandaloneMmCoreEntryPoint.h&g= t;
>
>  #in= clude <Guid/MemoryAllocationHob.h>
>
> -//
> -// Cache c= opy of HobList pointer.
> -//
> -VOID *gHobList =3D NULL;
> -
>  /**
> = ;   Returns the pointer to the HOB list.
>= ;
> diff --git
>= a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo
<= div dir=3D"ltr">> reHobLib.c
> b/Standalone= MmPkg/Library/StandaloneMmCoreHobLib/X64/Standalone
> MmCoreHobLib.c
> similarity index 70%<= br>
> rename from
> S= tandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore
> HobLib.c
> rename to
> StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64= /StandaloneM
> mCoreHobLib.c
> index e3d4743b63f2..69b20bf07a21 100644
> ---
> a/StandaloneMmPkg/Library/Sta= ndaloneMmCoreHobLib/StandaloneMmCo
> reHobLib.= c
> +++
> b/Stand= aloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standalone
> MmCoreHobLib.c
> @@ -13,14 +13,= 10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include <Library/HobLib.h>
&g= t;  #include <Library/DebugLib.h>
>=   #include <Library/BaseMemoryLib.h>
&= gt; +#include <Library/StandaloneMmCoreEntryPoint.h>
>
>  #include <Guid/Memo= ryAllocationHob.h>
>
> -//
> -// Cache copy of HobList poin= ter.
> -//
> -VOI= D *gHobList =3D NULL;
> -
>  /**
>    Returns th= e pointer to the HOB list.
>
> @@ -203,48 +199,13 @@ GetBootModeHob (
>    return HandOffHob->BootMode;
>  }
>
> -VOID *
> -CreateHob (
> -  IN  UINT16    HobType,
> -  IN  UINT16    HobLength
> -  )
> -{
> -  EFI_HOB_HANDOFF_INFO_TABLE  *HandOffHob;
> -  EFI_HOB_GENERIC_HEADER    &= nbsp; *HobEnd;
> -  EFI_PHYSICAL_ADDRESS&= nbsp;       FreeMemory;
> -&nbs= p; VOID                   = ;     *Hob;
> -
> -  HandOffHob =3D GetHobList ();
= > -
> -  HobLength =3D (UINT16)((HobLe= ngth + 0x7) & (~0x7));
> -
> -  FreeMemory =3D HandOffHob->EfiFreeMemoryTop - Ha= ndOffHob-
> >EfiFreeMemoryBottom;
=
> -
> -  if (FreeMemo= ry < HobLength) {
> -    return N= ULL;
> -  }
>= ; -
> -  Hob =3D (VOID*) (UINTN) HandOffH= ob->EfiEndOfHobList;
> -  ((EFI_HOB_GE= NERIC_HEADER*) Hob)->HobType =3D HobType;
>= -  ((EFI_HOB_GENERIC_HEADER*) Hob)->HobLength =3D HobLength;
> -  ((EFI_HOB_GENERIC_HEADER*) Hob)->Reser= ved =3D 0;
> -
> = -  HobEnd =3D (EFI_HOB_GENERIC_HEADER*) ((UINTN)Hob + HobLength);
<= /div>
> -  HandOffHob->EfiEndOfHobList =3D (EFI_= PHYSICAL_ADDRESS) (UINTN)
> HobEnd;
<= div dir=3D"ltr">> -
> -  HobEnd->Ho= bType  =3D EFI_HOB_TYPE_END_OF_HOB_LIST;
&g= t; -  HobEnd->HobLength =3D sizeof (EFI_HOB_GENERIC_HEADER);
> -  HobEnd->Reserved  =3D 0;
=
> -  HobEnd++;
> -&nb= sp; HandOffHob->EfiFreeMemoryBottom =3D (EFI_PHYSICAL_ADDRESS) (UINTN)
> HobEnd;
> -
<= /div>
> -  return Hob;
&g= t; -}
> -
> = /**
>    Builds a HOB for a loaded = PE32 module.
>
>=     This function builds a HOB for a loaded PE32 module.
> +  It can only be invoked during PEI phase;
=
> +  for MM phase, it will ASSERT() because = PEI HOB is read-only for MM
> phase.
=
> +
>    If Modu= leName is NULL, then ASSERT().
>    = If there is no additional space for HOB creation, then ASSERT().
<= div dir=3D"ltr">>
> @@ -263,31 +224,51 @@ = BuildModuleHob (
>    IN EFI_PHYSICA= L_ADDRESS  EntryPoint
>    )
>  {
> - = ; EFI_HOB_MEMORY_ALLOCATION_MODULE  *Hob;
&g= t; +  //
> +  // PEI HOB is read onl= y for MM phase
> +  //
> +  ASSERT (FALSE);
> +}
>
> -  ASSERT= (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) =3D=3D 0) &&<= br>
> -          ((Module= Length & (EFI_PAGE_SIZE - 1)) =3D=3D 0));
>= ; +/**
> +  Builds a HOB that describes a= chunk of system memory with Owner GUID.
>
> -  Hob =3D CreateHob (EFI_HOB_TYPE_MEMORY= _ALLOCATION, sizeof
> (EFI_HOB_MEMORY_ALLOCATI= ON_MODULE));
> +  This function builds a = HOB that describes a chunk of system memory.
>= +  It can only be invoked during PEI phase;
> +  for MM phase, it will ASSERT() since PEI HOB is read-only for= MM phase.
>
> -=   CopyGuid (&(Hob->MemoryAllocationHeader.Name),
> &gEfiHobMemoryAllocModuleGuid);
> -  Hob->MemoryAllocationHeader.MemoryBaseAddress =3D
> MemoryAllocationModule;
> -  Hob->MemoryAllocationHeader.MemoryLength    &nbs= p; =3D ModuleLength;
> -  Hob->MemoryA= llocationHeader.MemoryType        =3D EfiBootServicesCo= de;
> +  If there is no additional space = for HOB creation, then ASSERT().
>
<= div dir=3D"ltr">> +  @param  ResourceType      =   The type of resource described by this HOB.
> +  @param  ResourceAttribute  The resource attribute= s of the memory
> described by this HOB.
> +  @param  PhysicalStart    &= nbsp; The 64 bit physical address of memory
>= described by this HOB.
> +  @param = NumberOfBytes      The length of the memory described by t= his
> HOB in bytes.
= > +  @param  OwnerGUID          GUID= for the owner of this resource.
> +
=
> +**/
> +VOID
> +EFIAPI
> +BuildResourceDe= scriptorWithOwnerHob (
> +  IN EFI_RESOUR= CE_TYPE            ResourceType,
> +  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAtt= ribute,
> +  IN EFI_PHYSICAL_ADDRESS = ;       PhysicalStart,
> +&nbs= p; IN UINT64                  =     NumberOfBytes,
> +  IN EFI= _GUID                    = *OwnerGUID
> +  )
> +{
>    //
> -  // Zero the reserved space to match HOB spec
> +  // PEI HOB is read only for MM phase
>    //
> -&n= bsp; ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob-
> >MemoryAllocationHeader.Reserved));
> -
> -  CopyGuid (&= Hob->ModuleName, ModuleName);
> -  Hob= ->EntryPoint =3D EntryPoint;
> +  ASSE= RT (FALSE);
>  }
>
>  /**
= >    Builds a HOB that describes a chunk of system memory.
=
>
>    Th= is function builds a HOB that describes a chunk of system memory.
=
> +  It can only be invoked during PEI phase;
<= /div>
> +  for MM phase, it will ASSERT() because P= EI HOB is read-only for MM
> phase.
<= div dir=3D"ltr">> +
>    If there= is no additional space for HOB creation, then ASSERT().
>
>    @param  Re= sourceType        The type of resource described by thi= s HOB.
> @@ -305,31 +286,32 @@ BuildResourceDe= scriptorHob (
>    IN UINT64  &= nbsp;                   Numbe= rOfBytes
>    )
>  {
> -  EFI_HOB_RESOURCE_= DESCRIPTOR  *Hob;
> -
> -  Hob =3D CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR,= sizeof
> (EFI_HOB_RESOURCE_DESCRIPTOR));
<= /div>
> -  ASSERT (Hob !=3D NULL);
> -
> -  Hob->ResourceTyp= e      =3D ResourceType;
> -&nb= sp; Hob->ResourceAttribute =3D ResourceAttribute;
> -  Hob->PhysicalStart    =3D PhysicalStart;
=
> -  Hob->ResourceLength    =3D= NumberOfBytes;
> +  //
> +  // PEI HOB is read only for MM phase
> +  //
> +  ASSERT (F= ALSE);
>  }
>= ;
>  /**
> = -  Builds a GUID HOB with a certain data length.
> +  Builds a customized HOB tagged with a GUID for identifica= tion and
> returns
&= gt; +  the start address of GUID HOB data.
&= gt;
>    This function builds a cus= tomized HOB tagged with a GUID for
> identific= ation
>    and returns the start add= ress of GUID HOB data so that caller can fill the
> customized data.
>    The HOB = Header and Name field is already stripped.
> +=   It can only be invoked during PEI phase.
&= gt; +  For MM phase, it will ASSERT() because PEI HOB is read-only for= MM
> phase.
> +<= br>
>    If Guid is NULL, then ASSERT().=
>    If there is no additional spac= e for HOB creation, then ASSERT().
> -  I= f DataLength >=3D (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().=
> +  If DataLength > (0xFFF8 - sizeof= (EFI_HOB_GUID_TYPE)), then ASSERT().
> + = ; HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is
=
> 0xFFF8.
>
>    @param  Guid      =     The GUID to tag the customized HOB.
>    @param  DataLength    The size of the dat= a payload for the GUID HOB.
>
> -  @return The start address of GUID HOB data.
> +  @retval  NULL      &nbs= p; The GUID HOB could not be allocated.
> +&n= bsp; @retval  others      The start address of GUID HO= B data.
>
> = ; **/
>  VOID *
> @@ -339,35 +321,36 @@ BuildGuidHob (
>&n= bsp;   IN UINTN               =       DataLength
>  &nbs= p; )
>  {
> = -  EFI_HOB_GUID_TYPE *Hob;
> -
<= div dir=3D"ltr">>    //
> - = // Make sure that data length is not too long.
&= gt; +  // PEI HOB is read only for MM phase
= >    //
> -  ASSERT (DataLen= gth <=3D (0xffff - sizeof (EFI_HOB_GUID_TYPE)));
> -
> -  Hob =3D CreateHob (EFI_HOB= _TYPE_GUID_EXTENSION, (UINT16) (sizeof
> (EFI_= HOB_GUID_TYPE) + DataLength));
> -  CopyG= uid (&Hob->Name, Guid);
> -  retur= n Hob + 1;
> +  ASSERT (FALSE);
=
> +  return NULL;
>&n= bsp; }
>
> -
=
>  /**
> - = ; Copies a data buffer to a newly-built HOB.
>= +  Builds a customized HOB tagged with a GUID for identification, cop= ies the
> input data to the HOB
> +  data field, and returns the start address of the G= UID HOB data.
>
>= ; -  This function builds a customized HOB tagged with a GUID for
<= /div>
> identification,
> -=   copies the input data to the HOB data field and returns the start ad= dress
> of the GUID HOB data.
> +  This function builds a customized HOB tagged with a = GUID for
> identification and copies the input=
> +  data to the HOB data field and retu= rns the start address of the GUID HOB
> data.&= nbsp; It can only be
> +  invoked during = PEI phase; for MM phase, it will ASSERT() because PEI
> HOB is read-only for MM phase.
>&nbs= p;   The HOB Header and Name field is already stripped.
> +  It can only be invoked during PEI phase.
=
> +  For MM phase, it will ASSERT() because PEI HO= B is read-only for MM
> phase.
> +
>    If Guid is NU= LL, then ASSERT().
>    If Data is N= ULL and DataLength > 0, then ASSERT().
>&nb= sp;   If there is no additional space for HOB creation, then ASSERT().=
> -  If DataLength >=3D (0x10000 - si= zeof (EFI_HOB_GUID_TYPE)), then ASSERT().
> +&= nbsp; If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT= ().
> +  HobLength is UINT16 and multiple= s of 8 bytes, so the max HobLength is
> 0xFFF8= .
>
>  &nbs= p; @param  Guid          The GUID to tag the = customized HOB.
>    @param  Da= ta          The data to be copied into the data fi= eld of the GUID
> HOB.
>    @param  DataLength    The size of the d= ata payload for the GUID HOB.
>
> -  @return The start address of GUID HOB data.
> +  @retval  NULL      &n= bsp; The GUID HOB could not be allocated.
> +=   @retval  others      The start address of GUID = HOB data.
>
>&nb= sp; **/
>  VOID *
> @@ -378,20 +361,22 @@ BuildGuidDataHob (
= >    IN UINTN              =         DataLength
> = ;   )
>  {
> -  VOID  *HobData;
> -
> -  ASSERT (Data !=3D NULL || DataLength =3D=3D= 0);
> -
> - = ; HobData =3D BuildGuidHob (Guid, DataLength);
&g= t; -
> -  return CopyMem (HobData, Data, = DataLength);
> +  //
> +  // PEI HOB is read only for MM phase
> +  //
> +  ASSERT (FA= LSE);
> +  return NULL;
>  }
>
>  /**
>    Builds a F= irmware Volume HOB.
>
>    This function builds a Firmware Volume HOB.
<= div dir=3D"ltr">> +  It can only be invoked during PEI phase;
> +  for MM phase, it will ASSERT() because PE= I HOB is read-only for MM
> phase.
> +
>    If there = is no additional space for HOB creation, then ASSERT().
> +  If the FvImage buffer is not at its required alignme= nt, then ASSERT()
------=_Part_3043618_24503051.1616618010532--