From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76888+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76888+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416765; cv=none; d=zohomail.com; s=zohoarc; b=Q0nBX34b9Q9wvvxBlkcG+TF4/qoCmCPqRHvs5TohTgT66QF7/4sC+bHYlU4601bj60s5x+610v7KX029ZWblA8LGs/CrjbK1e6ogZ/edmru1S1D11/2xGEMZ1uTI0qJBkFczWh7RFECtbUmPr8xPc50UZMPrRWHW1SG6xFSrAnE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416765; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=BAnxl8W+Hzx/gd9Rc285hgian45+7R1BFvklhbQFwTI=; b=eBXmfp/iklnWEFRolsTcN4Q38If5zngcUVBsYXe2nnMgTX9bBGExootic/oLfX3lVJwKla0pniBXV8z4gPwk+iPD4M6GyQtMmbCMpcsN1Fdep+WGwuu0NyBXXvLnM0PcD30ckEXepnMX6jEZS183pbHONoM6yW9fp2zvdRMJcSs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76888+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416765296707.3280100496638; Tue, 22 Jun 2021 19:52:45 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7hioYY1788612xtqEDMqL9G1; Tue, 22 Jun 2021 19:52:44 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web08.2350.1624416764304600337 for ; Tue, 22 Jun 2021 19:52:44 -0700 IronPort-SDR: Y346ySDnGdMptqsSQf95IEa3dtQWWBK68g8yK3f1G8FdKbIgCXIM5K3sLv0bO3Fqeah7sZ2QHM 7TVFv1hzvpvw== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175477" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175477" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:42 -0700 IronPort-SDR: Tbi0RQDhnGaxLqc0g9w4oTdiyfGXsll3mFj/HiSZioci+BUerTTAwJuedfH6dGBXIde8XmFkOX b+GgLzz4VL2Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138245" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:40 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You , Ray Ni Subject: [edk2-devel] [Patch V2 01/12] UefiPayloadPkg: Add HobLib for UniversalPayload Date: Wed, 23 Jun 2021 10:52:24 +0800 Message-Id: <20210623025235.3311-2-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: pwA40L7jJA3C3MAQO9K2F390x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416764; bh=wxK9ufKf/SGcYuHYoBIh54Z4jRUph8nONrs8wIRavmk=; h=Cc:Date:From:Reply-To:Subject:To; b=WgbwrMfdLG4+Q/ZN1t7lPeHr6haDuu96yxTNE9kMfHuDzmQ0iU2AgoVs9XTogXp0QK4 Pb+YYs6UUnDJRNDlfUJG5uuTajSuMy+5bdLulXbGMpXq5R2RWLCk2uxazcFYFn4DPPNMJ 12uqv3sQ9ltqWrZhRsQ5gRu3Pp25HEHE/Gg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" V1: For payload entry, use PayloadEntryHobLib as HobLib and payload entry should initialize hob base. For DxeCore, use new added DxeHobLib as HobLib, and DxeCore will initialize hob base. For Dxe Driver, use new added DxeHobLib as HobLib, and use DxeHobListLib to initialize hob base. V2: Remove the UefiLib since it won't be needed. Adding a new library DxeHobLib + DxeHobListLib instead of using the DxeHobLib.inf in MdePkg is because the constructor needed be separated from DxeHobLib. If not, when building UefiPayloadPkg, the dependency chain is as below: DebugLib -> SerialPortLib -> PlatformHookLib -> HobLib -> DebugLib Each library has a constructor, and this becomes a constructor circle. To break the circle, separate the constructor from the HobLib as a new DxeHobListLib, which won't depend on DebugLib. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Signed-off-by: Ray Ni Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- UefiPayloadPkg/Include/Library/DxeHobListLib.h | 27 +++= ++++++++++++++++++++++++ UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf | 36 +++= +++++++++++++++++++++++++++++++++ UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni | 16 +++= +++++++++++++ UefiPayloadPkg/Library/DxeHobLib/HobLib.c | 597 +++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.c | 66 +++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf | 35 +++= ++++++++++++++++++++++++++++++++ UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c | 20 +++= +++++++++++++++++ UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.inf | 28 +++= +++++++++++++++++++++++++ UefiPayloadPkg/Library/{HobLib =3D> PayloadEntryHobLib}/Hob.c | 2 +- UefiPayloadPkg/Library/{HobLib =3D> PayloadEntryHobLib}/HobLib.inf | 2 +- UefiPayloadPkg/UefiPayloadPkg.dsc | 15 +++= ++++++++---- 11 files changed, 838 insertions(+), 6 deletions(-) diff --git a/UefiPayloadPkg/Include/Library/DxeHobListLib.h b/UefiPayloadPk= g/Include/Library/DxeHobListLib.h new file mode 100644 index 0000000000..7e9b23f6d7 --- /dev/null +++ b/UefiPayloadPkg/Include/Library/DxeHobListLib.h @@ -0,0 +1,27 @@ +/** @file + Provides a service to retrieve a pointer to the start of HOB list. + Only available to DXE module types. + + This library does not contain any functions or macros. It simply export= s a global + pointer to the start of HOB list as defined in the Platform Initializati= on Driver + Execution Environment Core Interface Specification. The library constru= ctor must + initialize this global pointer to the start of HOB list, so it is availa= ble at the + module's entry point. Since there is overhead in looking up the pointer= to the start + of HOB list, only those modules that actually require access to the HOB = list + should use this library. + +Copyright (c) 2021, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DXE_HOB_LIST_LIB_H__ +#define __DXE_HOB_LIST_LIB_H__ + +/// +/// Cache copy of the start of HOB list +/// +extern VOID *gHobList; + +#endif + diff --git a/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf b/UefiPayloadPk= g/Library/DxeHobLib/DxeHobLib.inf new file mode 100644 index 0000000000..ff334a0d41 --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf @@ -0,0 +1,36 @@ +## @file +# HOB Library implementation for Payload Phase. +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D DxeHobLib + MODULE_UNI_FILE =3D DxeHobLib.uni + FILE_GUID =3D 1a15b8b3-3e8a-4698-87b9-65aad9993b52 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D HobLib|DXE_DRIVER DXE_RUNTIME_DRIVER = SMM_CORE DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER + +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# + +[Sources] + HobLib.c + + +[Packages] + MdePkg/MdePkg.dec + UefiPayloadPkg/UefiPayloadPkg.dec + + +[LibraryClasses] + BaseMemoryLib + DebugLib + DxeHobListLib diff --git a/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni b/UefiPayloadPk= g/Library/DxeHobLib/DxeHobLib.uni new file mode 100644 index 0000000000..4e02e9c2ae --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni @@ -0,0 +1,16 @@ +// /** @file +// HOB Library implementation for Payload Phase. +// +// The Hoblist will be set by DxeHobListLib or other modules. +// +// Copyright (c) 2021, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "HOB Library imple= mentation for Payload Phase." + +#string STR_MODULE_DESCRIPTION #language en-US "The HOB Library i= mplementation for Payload Phase that doesn't contain HobLibConstructor" + diff --git a/UefiPayloadPkg/Library/DxeHobLib/HobLib.c b/UefiPayloadPkg/Lib= rary/DxeHobLib/HobLib.c new file mode 100644 index 0000000000..5d5ede0c17 --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobLib/HobLib.c @@ -0,0 +1,597 @@ +/** @file + HOB Library implementation for Payload Phase. + +Copyright (c) 2021, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include + +/** + Returns the pointer to the HOB list. + + This function returns the pointer to first HOB in the list. + For PEI phase, the PEI service GetHobList() can be used to retrieve the = pointer + to the HOB list. For the DXE phase, the HOB list pointer can be retriev= ed through + the EFI System Table by looking up theHOB list GUID in the System Config= uration Table. + Since the System Configuration Table does not exist that the time the DX= E Core is + launched, the DXE Core uses a global variable from the DXE Core Entry Po= int Library + to manage the pointer to the HOB list. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @return The pointer to the HOB list. + +**/ +VOID * +EFIAPI +GetHobList ( + VOID + ) +{ + ASSERT (gHobList !=3D NULL); + return gHobList; +} + +/** + Returns the next instance of a HOB type from the starting HOB. + + This function searches the first instance of a HOB type from the startin= g HOB pointer. + If there does not exist such HOB type from the starting HOB pointer, it = will return NULL. + In contrast with macro GET_NEXT_HOB(), this function does not skip the s= tarting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the r= equirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current Ho= bStart. + + If HobStart is NULL, then ASSERT(). + + @param Type The HOB type to return. + @param HobStart The starting HOB pointer to search from. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextHob ( + IN UINT16 Type, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS Hob; + + ASSERT (HobStart !=3D NULL); + + Hob.Raw =3D (UINT8 *) HobStart; + // + // Parse the HOB list until end of list or matching type is found. + // + while (!END_OF_HOB_LIST (Hob)) { + if (Hob.Header->HobType =3D=3D Type) { + return Hob.Raw; + } + Hob.Raw =3D GET_NEXT_HOB (Hob); + } + return NULL; +} + +/** + Returns the first instance of a HOB type among the whole HOB list. + + This function searches the first instance of a HOB type among the whole = HOB list. + If there does not exist such HOB type in the HOB list, it will return NU= LL. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param Type The HOB type to return. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetFirstHob ( + IN UINT16 Type + ) +{ + VOID *HobList; + + HobList =3D GetHobList (); + return GetNextHob (Type, HobList); +} + +/** + Returns the next instance of the matched GUID HOB from the starting HOB. + + This function searches the first instance of a HOB from the starting HOB= pointer. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to = the input Guid. + If there does not exist such HOB from the starting HOB pointer, it will = return NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_S= IZE () + to extract the data section and its size information, respectively. + In contrast with macro GET_NEXT_HOB(), this function does not skip the s= tarting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the r= equirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current Ho= bStart. + + If Guid is NULL, then ASSERT(). + If HobStart is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + @param HobStart A pointer to a Guid. + + @return The next instance of the matched GUID HOB from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextGuidHob ( + IN CONST EFI_GUID *Guid, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS GuidHob; + + GuidHob.Raw =3D (UINT8 *) HobStart; + while ((GuidHob.Raw =3D GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob= .Raw)) !=3D NULL) { + if (CompareGuid (Guid, &GuidHob.Guid->Name)) { + break; + } + GuidHob.Raw =3D GET_NEXT_HOB (GuidHob); + } + return GuidHob.Raw; +} + +/** + Returns the first instance of the matched GUID HOB among the whole HOB l= ist. + + This function searches the first instance of a HOB among the whole HOB l= ist. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to = the input Guid. + If there does not exist such HOB from the starting HOB pointer, it will = return NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_S= IZE () + to extract the data section and its size information, respectively. + + If the pointer to the HOB list is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + + @return The first instance of the matched GUID HOB among the whole HOB l= ist. + +**/ +VOID * +EFIAPI +GetFirstGuidHob ( + IN CONST EFI_GUID *Guid + ) +{ + VOID *HobList; + + HobList =3D GetHobList (); + return GetNextGuidHob (Guid, HobList); +} + +/** + Get the system boot mode from the HOB list. + + This function returns the system boot mode information from the + PHIT HOB in HOB list. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param VOID + + @return The Boot Mode. + +**/ +EFI_BOOT_MODE +EFIAPI +GetBootModeHob ( + VOID + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + + HandOffHob =3D (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); + + return HandOffHob->BootMode; +} + +/** + 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 DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If ModuleName is NULL, then ASSERT(). + If there is no additional space for HOB creation, then ASSERT(). + + @param ModuleName The GUID File Name of the module. + @param MemoryAllocationModule The 64 bit physical address of the modul= e. + @param ModuleLength The length of the module in bytes. + @param EntryPoint The 64 bit physical address of the modul= e entry point. + +**/ +VOID +EFIAPI +BuildModuleHob ( + IN CONST EFI_GUID *ModuleName, + IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, + IN UINT64 ModuleLength, + IN EFI_PHYSICAL_ADDRESS EntryPoint + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB that describes a chunk of system memory with Owner GUID. + + This function builds a HOB that describes a chunk of system memory. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + + @param ResourceType The type of resource described by this HOB. + @param ResourceAttribute The resource attributes of the memory descri= bed by this HOB. + @param PhysicalStart The 64 bit physical address of memory descri= bed by this HOB. + @param NumberOfBytes The length of the memory described by this H= OB in bytes. + @param OwnerGUID GUID for the owner of this resource. + +**/ +VOID +EFIAPI +BuildResourceDescriptorWithOwnerHob ( + IN EFI_RESOURCE_TYPE ResourceType, + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, + IN EFI_PHYSICAL_ADDRESS PhysicalStart, + IN UINT64 NumberOfBytes, + IN EFI_GUID *OwnerGUID + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB that describes a chunk of system memory. + + This function builds a HOB that describes a chunk of system memory. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + + @param ResourceType The type of resource described by this HOB. + @param ResourceAttribute The resource attributes of the memory descri= bed by this HOB. + @param PhysicalStart The 64 bit physical address of memory descri= bed by this HOB. + @param NumberOfBytes The length of the memory described by this H= OB in bytes. + +**/ +VOID +EFIAPI +BuildResourceDescriptorHob ( + IN EFI_RESOURCE_TYPE ResourceType, + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, + IN EFI_PHYSICAL_ADDRESS PhysicalStart, + IN UINT64 NumberOfBytes + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} + +/** + Builds a customized HOB tagged with a GUID for identification and returns + the start address of GUID HOB data. + + This function builds a customized HOB tagged with a GUID for identificat= ion + and returns the start address of GUID HOB data so that caller can fill t= he customized data. + The HOB Header and Name field is already stripped. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If Guid is NULL, then ASSERT(). + If there is no additional space for HOB creation, 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 0x= FFF8. + + @param Guid The GUID to tag the customized HOB. + @param DataLength The size of the data payload for the GUID HOB. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidHob ( + IN CONST EFI_GUID *Guid, + IN UINTN DataLength + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); + return NULL; +} + +/** + Builds a customized HOB tagged with a GUID for identification, copies th= e input data to the HOB + data field, and returns the start address of the GUID HOB data. + + This function builds a customized HOB tagged with a GUID for identificat= ion and copies the input + data to the HOB data field and returns the start address of the GUID HOB= data. It can only be + invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB = is read-only for DXE phase. + The HOB Header and Name field is already stripped. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If Guid is NULL, then ASSERT(). + If Data is NULL and DataLength > 0, then ASSERT(). + If there is no additional space for HOB creation, 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 0x= FFF8. + + @param Guid The GUID to tag the customized HOB. + @param Data The data to be copied into the data field of the G= UID HOB. + @param DataLength The size of the data payload for the GUID HOB. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidDataHob ( + IN CONST EFI_GUID *Guid, + IN VOID *Data, + IN UINTN DataLength + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); + return NULL; +} + +/** + Builds a Firmware Volume HOB. + + This function builds a Firmware Volume HOB. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + +**/ +VOID +EFIAPI +BuildFvHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} + +/** + Builds a EFI_HOB_TYPE_FV2 HOB. + + This function builds a EFI_HOB_TYPE_FV2 HOB. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + @param FvName The name of the Firmware Volume. + @param FileName The name of the file. + +**/ +VOID +EFIAPI +BuildFv2Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN CONST EFI_GUID *FvName, + IN CONST EFI_GUID *FileName + ) +{ + ASSERT (FALSE); +} + +/** + Builds a EFI_HOB_TYPE_FV3 HOB. + + This function builds a EFI_HOB_TYPE_FV3 HOB. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + @param AuthenticationStatus The authentication status. + @param ExtractedFv TRUE if the FV was extracted as a file wit= hin + another firmware volume. FALSE otherwise. + @param FvName The name of the Firmware Volume. + Valid only if IsExtractedFv is TRUE. + @param FileName The name of the file. + Valid only if IsExtractedFv is TRUE. + +**/ +VOID +EFIAPI +BuildFv3Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT32 AuthenticationStatus, + IN BOOLEAN ExtractedFv, + IN CONST EFI_GUID *FvName, OPTIONAL + IN CONST EFI_GUID *FileName OPTIONAL + ) +{ + ASSERT (FALSE); +} + +/** + Builds a Capsule Volume HOB. + + This function builds a Capsule Volume HOB. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If the platform does not support Capsule Volume HOBs, then ASSERT(). + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The base address of the Capsule Volume. + @param Length The size of the Capsule Volume in bytes. + +**/ +VOID +EFIAPI +BuildCvHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB for the CPU. + + This function builds a HOB for the CPU. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + + @param SizeOfMemorySpace The maximum physical memory addressability o= f the processor. + @param SizeOfIoSpace The maximum physical I/O addressability of t= he processor. + +**/ +VOID +EFIAPI +BuildCpuHob ( + IN UINT8 SizeOfMemorySpace, + IN UINT8 SizeOfIoSpace + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB for the Stack. + + This function builds a HOB for the stack. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the Stack. + @param Length The length of the stack in bytes. + +**/ +VOID +EFIAPI +BuildStackHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB for the BSP store. + + This function builds a HOB for BSP store. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the BSP. + @param Length The length of the BSP store in bytes. + @param MemoryType Type of memory allocated by this HOB. + +**/ +VOID +EFIAPI +BuildBspStoreHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN EFI_MEMORY_TYPE MemoryType + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB for the memory allocation. + + This function builds a HOB for the memory allocation. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the memory. + @param Length The length of the memory allocation in bytes. + @param MemoryType Type of memory allocated by this HOB. + +**/ +VOID +EFIAPI +BuildMemoryAllocationHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN EFI_MEMORY_TYPE MemoryType + ) +{ + // + // PEI HOB is read only for DXE phase + // + ASSERT (FALSE); +} diff --git a/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.c b/UefiPay= loadPkg/Library/DxeHobListLib/DxeHobListLib.c new file mode 100644 index 0000000000..8bb31b3f9c --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.c @@ -0,0 +1,66 @@ +/** @file + This library retrieve the EFI_BOOT_SERVICES pointer from EFI system tabl= e in + library's constructor. + + Copyright (c) 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include + +VOID *gHobList =3D NULL; + +/** + Local implementation of GUID comparasion that doesn't depend on DebugLib= ::ASSERT(). + + This function compares Guid1 to Guid2. If the GUIDs are identical then = TRUE is returned. + If there are any bit differences in the two GUIDs, then FALSE is returne= d. + + @param Guid1 A pointer to a 128 bit GUID. + @param Guid2 A pointer to a 128 bit GUID. + + @retval TRUE Guid1 and Guid2 are identical. + @retval FALSE Guid1 and Guid2 are not identical. +**/ +BOOLEAN +LocalCompareGuid ( + IN CONST GUID *Guid1, + IN CONST GUID *Guid2 + ) +{ + UINT64 *Left; + UINT64 *Right; + + Left =3D (UINT64 *) Guid1; + Right =3D (UINT64 *) Guid2; + + return (BOOLEAN) (Left[0] =3D=3D Right[0] && Left[1] =3D=3D Right[1]); +} + +/** + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +DxeHobListLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + UINTN Index; + + for (Index =3D 0; Index < SystemTable->NumberOfTableEntries; Index++) { + if (LocalCompareGuid (&gEfiHobListGuid, &SystemTable->ConfigurationTab= le[Index].VendorGuid)) { + gHobList =3D SystemTable->ConfigurationTable[Index].VendorTable; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} diff --git a/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf b/UefiP= ayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf new file mode 100644 index 0000000000..1115949556 --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf @@ -0,0 +1,35 @@ +## @file +# UEFI Boot Services Table Library implementation. +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D UefiPayloadInitHobLib + FILE_GUID =3D ff5c7a21-ab7a-4366-8616-11c6e53247b6 + MODULE_TYPE =3D UEFI_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D DxeHobListLib|DXE_DRIVER DXE_RUNTIME= _DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE + + CONSTRUCTOR =3D DxeHobListLibConstructor + +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# + +[Sources] + DxeHobListLib.c + +[Packages] + MdePkg/MdePkg.dec + UefiPayloadPkg/UefiPayloadPkg.dec + +[Guids] + gEfiHobListGuid ## CONSUMES + + diff --git a/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c b= /UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c new file mode 100644 index 0000000000..92d3e17ef0 --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c @@ -0,0 +1,20 @@ +/** @file + This library retrieve the EFI_BOOT_SERVICES pointer from EFI system tabl= e in + library's constructor. + + Copyright (c) 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include + +EFI_STATUS +EFIAPI +DxeHobListLibNullConstructor ( + VOID + ) +{ + return EFI_SUCCESS; +} diff --git a/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.inf= b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.inf new file mode 100644 index 0000000000..f17e5ebdbd --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.inf @@ -0,0 +1,28 @@ +## @file +# UEFI Boot Services Table Library implementation. +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D DxeHobListLibNull + MODULE_TYPE =3D BASE + FILE_GUID =3D 060876c2-0e4e-4c63-8996-6af3710cfa64 + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D DxeHobListLib + CONSTRUCTOR =3D DxeHobListLibNullConstructor + +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# + +[Packages] + MdePkg/MdePkg.dec + +[Sources] + DxeHobListLibNull.c diff --git a/UefiPayloadPkg/Library/HobLib/Hob.c b/UefiPayloadPkg/Library/P= ayloadEntryHobLib/Hob.c similarity index 96% rename from UefiPayloadPkg/Library/HobLib/Hob.c rename to UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c index c0b4cc0b0f..23a749edf1 100644 --- a/UefiPayloadPkg/Library/HobLib/Hob.c +++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c @@ -1,7 +1,7 @@ /** @file =20 Copyright (c) 2010, Apple Inc. All rights reserved.
- Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 diff --git a/UefiPayloadPkg/Library/HobLib/HobLib.inf b/UefiPayloadPkg/Libr= ary/PayloadEntryHobLib/HobLib.inf similarity index 87% rename from UefiPayloadPkg/Library/HobLib/HobLib.inf rename to UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf index 030e22a810..cbb4f02efc 100644 --- a/UefiPayloadPkg/Library/HobLib/HobLib.inf +++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf @@ -1,6 +1,6 @@ #/** @file # -# Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 21b360256b..d8277efccd 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -27,6 +27,7 @@ =20 DEFINE SOURCE_DEBUG_ENABLE =3D FALSE DEFINE PS2_KEYBOARD_ENABLE =3D FALSE + DEFINE UNIVERSAL_PAYLOAD =3D FALSE =20 # # SBL: UEFI payload for Slim Bootloader @@ -146,6 +147,13 @@ PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMain= tenanceLib.inf SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf + +!if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE + HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf +!else + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf +!endif =20 # # UEFI & PI @@ -221,10 +229,12 @@ VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf =20 [LibraryClasses.common.SEC] - HobLib|UefiPayloadPkg/Library/HobLib/HobLib.inf + HobLib|UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull= .inf =20 [LibraryClasses.common.DXE_CORE] + DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull= .inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf @@ -238,7 +248,6 @@ =20 [LibraryClasses.common.DXE_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -251,7 +260,6 @@ =20 [LibraryClasses.common.DXE_RUNTIME_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ibRuntimeDxe.inf @@ -260,7 +268,6 @@ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf =20 ##########################################################################= ###### # --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76888): https://edk2.groups.io/g/devel/message/76888 Mute This Topic: https://groups.io/mt/83730176/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76889+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76889+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416771; cv=none; d=zohomail.com; s=zohoarc; b=HLwaDtt6BgLlgCOHyOV/iwKFQNc1KE9cuMmmqdpScYWN176MzBUj4OqXdWBjbd5h86zBv7ecL+JTJFoZh5bQdstxegwoQo3yMReihfTDHfoKoI3OrRnwo1UXPSOKfbjYzI3U1NbdpcJPBog6ck5sN0oxLm3ZNndx2ocKWh0mIGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416771; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=rp0MzAaN+mxj63tflS/S1L1vS7enu2m02eCVMS3q95A=; b=AjKFEfNKYFBKMejlfpOnVvUsYNLDrEHQPn2zbSIodhb4RKSR3dh5LKZ6ZTV6bOBQbFUcXN6HmV083EH029+hl3V0OkiitRsNm9Rzre/6ZPcZmAe8CPgVXewBHk/EVCxXmVjOqHPdSlnWBkfxMzt5VdeDp/PRN/yZgtI4MQ84QxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76889+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416771044531.2993194689735; Tue, 22 Jun 2021 19:52:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7vnpYY1788612xhpgQMwZaj8; Tue, 22 Jun 2021 19:52:45 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:45 -0700 IronPort-SDR: 6CGN2Ds+5/DF4/W9F4DN9o4d47PF44pdhqzZ2l++Bad4c3oS0yVtPAxd2zM/iGL+zn3iYB9rU/ SNEqEjj973Lw== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175486" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175486" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:44 -0700 IronPort-SDR: tTgwDr3RphbBmftaTJkj3dAbH55Q+Q9HQfPDbswFcCkxiWzf3wMGkN8hnbaJNfbojHvdEWXtFz pHrQM64Ulw4A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138256" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:43 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Ray Ni Subject: [edk2-devel] [Patch V2 02/12] MdeModulePkg: Add new structure for the Universal Payload Serial Port Info Date: Wed, 23 Jun 2021 10:52:25 +0800 Message-Id: <20210623025235.3311-3-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: z2fL6UCHMZowBfvhOSYvzowux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416765; bh=Jw94g7c6uofVFHvUMv9cBEY+jIZjDfugkkx37KIux30=; h=Cc:Date:From:Reply-To:Subject:To; b=Kc/VYGwML+VWeyZG2TS7KGyFlrT2POu69eQpfRx0bCPiDFjAXpft7WUja7s8aVs3PDx eX77MnqIu2IcSMwonrZp7exKTfCXhtxbZgOIhbUmwvTeD06iX6nP1JljzI5jmbfDd9DpC oOnCBb80OBnzANp0I8j6t5+7h3GyxpPPjsw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add Universal Payload Serial Port Info definition header file according to Universal Payload's documentation as below: https://universalpayload.github.io/documentation/ Cc: Jian J Wang Cc: Hao A Wu Cc: Ray Ni Reviewed-by: Hao A Wu Signed-off-by: Zhiguang Liu --- MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h | 30 ++++++++++++++= ++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 3 +++ 2 files changed, 33 insertions(+) diff --git a/MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h b/MdeMo= dulePkg/Include/UniversalPayload/SerialPortInfo.h new file mode 100644 index 0000000000..87181f7634 --- /dev/null +++ b/MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h @@ -0,0 +1,30 @@ +/** @file + This file defines the structure for serial port info. + + Copyright (c) 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + - Universal Payload Specification 0.75 (https://universalpayload.githu= b.io/documentation/) +**/ + +#ifndef UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_ +#define UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_ + +#include + +#pragma pack(1) +typedef struct { + UNIVERSAL_PAYLOAD_GENERIC_HEADER Header; + BOOLEAN UseMmio; + UINT8 RegisterStride; + UINT32 BaudRate; + EFI_PHYSICAL_ADDRESS RegisterBase; +} UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO; +#pragma pack() + +#define UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_REVISION 1 + +extern GUID gUniversalPayloadSerialPortInfoGuid; + +#endif // UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_ diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 10602a8f79..ad84421cf3 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -422,6 +422,9 @@ ## Include/UniversalPayload/ExtraData.h gUniversalPayloadExtraDataGuid =3D {0x15a5baf6, 0x1c91, 0x467d, {0x9d, 0= xfb, 0x31, 0x9d, 0x17, 0x8d, 0x4b, 0xb4}} =20 + ## Include/UniversalPayload/SerialPortInfo.h + gUniversalPayloadSerialPortInfoGuid =3D { 0xaa7e190d, 0xbe21, 0x4409, { = 0x8e, 0x67, 0xa2, 0xcd, 0xf, 0x61, 0xe1, 0x70 } } + [Ppis] ## Include/Ppi/AtaController.h gPeiAtaControllerPpiGuid =3D { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0,= 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }} --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76889): https://edk2.groups.io/g/devel/message/76889 Mute This Topic: https://groups.io/mt/83730177/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76890+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76890+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416770; cv=none; d=zohomail.com; s=zohoarc; b=nzkKqPMLNEMGHUL3ZHYLW/yoCigxiOKkyLtdQ6XYiAq9TaYkcm7MnvXL9rMUOiRGvQBqgVfmBCW8ukwqq4bbMkXGf9Ya9O6Y/thtD8DxK0wvxSz5wHxjUmHbhEw/wEzPw0l3dkn2YOHIhx6Q4P3wdYVNVgjhML6oh77tHMxgGTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416770; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=BYUW/zWKNrvqFiTIvAEOHBA4RN9OR2dV2l6pO2Fsd0s=; b=esBl5e01G+GXrNeRDPzvDSRQ+nX6SGKE4OUU1shKc6Cbc8iaPxg5827Rujo+7KByvNGAyFz0BlkT/wizwfk2iUF9URe8Gni3fAA6gdc9maPJvqcq+hnUKaPcAOWziu6GmJvthfQcR9eWlA7mcapA8CzhHCK5orFblcj6+oLM0T0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76890+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416770964110.90243715634529; Tue, 22 Jun 2021 19:52:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id CbM1YY1788612xPhqAjtb2JF; Tue, 22 Jun 2021 19:52:47 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:47 -0700 IronPort-SDR: iro5st2jx+vvssQ7uRfRsS0VrvjMN2AbW5hYmBbK42wGBItrXB9SRTVrH0OaiqiK0EOuwMHxT4 rAhmmAfL6d4w== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175487" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175487" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:46 -0700 IronPort-SDR: tDbkHth9WxkrbTh7xJGF4fEBaaG/fBgm5XDSkzh15lJG6sRp96GjCryfvnEFpf0dB9Dnzl3SF2 PfXLFiLjJnmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138268" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:44 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 03/12] UefiPayloadPkg: Add a separate PlatformHookLib for Universal Payload Date: Wed, 23 Jun 2021 10:52:26 +0800 Message-Id: <20210623025235.3311-4-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: u0aTicmkKvu7fqFguf93L0orx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416767; bh=N1zU2HOp1KNCdUH6lJljc0CNODSiBgwUruyWqOPkgFY=; h=Cc:Date:From:Reply-To:Subject:To; b=oaOhe9Dr+fAkbVwx1e/+reyQwtoEe/zhhYfguOF1F178qEQal6sUDFaRoy1OoN8RCdy qgFI63tYiNZbp/TX6dPxw51aDYhWu+pQ1N6v00X8GGZK+P/T/yB3FOJnDldZPYIo3dyjS szq+hobi+4j36YfHvquV/gktq5JD9ofBVMY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add a new separate PlatformHookLib for Universal Payload to consume Guid Hob gUniversalPayloadSerialPortInfoGuid to get serial port information Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c = | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++ UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf= | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor= mHookLib.c b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor= mHookLib.c new file mode 100644 index 0000000000..6705f29505 --- /dev/null +++ b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLi= b.c @@ -0,0 +1,82 @@ +/** @file + Platform Hook Library instance for UART device. + + Copyright (c) 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +/** + Performs platform specific initialization required for the CPU to access + the hardware associated with a SerialPortLib instance. This function do= es + not initialize the serial port hardware itself. Instead, it initializes + hardware devices that are required for the CPU to access the serial port + hardware. This function may be called more than once. + + @retval RETURN_SUCCESS The platform specific initialization succee= ded. + @retval RETURN_DEVICE_ERROR The platform specific initialization could = not be completed. + +**/ +RETURN_STATUS +EFIAPI +PlatformHookSerialPortInitialize ( + VOID + ) +{ + RETURN_STATUS Status; + UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *SerialPortInfo; + UINT8 *GuidHob; + UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader; + + GuidHob =3D GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid); + if (GuidHob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + GenericHeader =3D (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA= (GuidHob); + if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE = (GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) { + return EFI_NOT_FOUND; + } + + if (GenericHeader->Revision =3D=3D UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_RE= VISION) { + SerialPortInfo =3D (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *) GET_GUID_HOB= _DATA (GuidHob); + if (GenericHeader->Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UN= IVERSAL_PAYLOAD_SERIAL_PORT_INFO, RegisterBase)) { + // + // Return if can't find the Serial Port Info Hob with enough length + // + return EFI_NOT_FOUND; + } + + Status =3D PcdSetBoolS (PcdSerialUseMmio, SerialPortInfo->UseMmio); + if (RETURN_ERROR (Status)) { + return Status; + } + Status =3D PcdSet64S (PcdSerialRegisterBase, SerialPortInfo->RegisterB= ase); + if (RETURN_ERROR (Status)) { + return Status; + } + Status =3D PcdSet32S (PcdSerialRegisterStride, SerialPortInfo->Registe= rStride); + if (RETURN_ERROR (Status)) { + return Status; + } + Status =3D PcdSet32S (PcdSerialBaudRate, SerialPortInfo->BaudRate); + if (RETURN_ERROR (Status)) { + return Status; + } + Status =3D PcdSet64S (PcdUartDefaultBaudRate, SerialPortInfo->BaudRate= ); + if (RETURN_ERROR (Status)) { + return Status; + } + + return RETURN_SUCCESS; + } + + return EFI_NOT_FOUND; +} diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor= mHookLib.inf b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platf= ormHookLib.inf new file mode 100644 index 0000000000..41e05ddf54 --- /dev/null +++ b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLi= b.inf @@ -0,0 +1,41 @@ +## @file +# Platform Hook Library instance for UART device for Universal Payload. +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PlatformHookLib + FILE_GUID =3D 807E05AB-9411-429F-97F0-FE425BF6B094 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PlatformHookLib + CONSTRUCTOR =3D PlatformHookSerialPortInitialize + +[Sources] + PlatformHookLib.c + +[LibraryClasses] + PcdLib + BaseLib + HobLib + DxeHobListLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiPayloadPkg/UefiPayloadPkg.dec + +[Guids] + gUniversalPayloadSerialPortInfoGuid + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate ## PRODUCES --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76890): https://edk2.groups.io/g/devel/message/76890 Mute This Topic: https://groups.io/mt/83730178/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76891+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76891+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416771; cv=none; d=zohomail.com; s=zohoarc; b=cdUBSX+NQlSP+ogfetW6h7vrtoSuIOqY4bTajC0V4HV87a8pPQFHz6QTGSPMLRkStqW1TvtihInGdX+W4/AvCYzinw9Gkj2ILk4Q+HkYpuXtZn2wZdCi7mDq57a2AyVqYuDWPXRQtD/fqdkN7Ilju+PHHgJ3yJJFP5HI+Bwy5Uk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416771; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=wWZ6ItWKcnC3lINyc9Es5NyQWV75b+xW5wTuWgFjmOE=; b=kOo7HmmSwEFc8VJkkiJ0WD88dh0AJDO4BlkqHJ1zkIy2QVN65QyhWTX6Yg12k1QV1H6gLo/rAU+BtGQ9rA621pOIa7a2ktqLu7zHhQxjwiUcS7TwruAZcq08xaGeJYsuss8RhXH3UPE+coFs24+TVJzrwrgq2YS1YypxyQPvdIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76891+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416771511248.36165435638645; Tue, 22 Jun 2021 19:52:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Oi7LYY1788612xh9MgGstlDV; Tue, 22 Jun 2021 19:52:51 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:48 -0700 IronPort-SDR: F46apl1dMSaW5cZac9nPaKaYKEeNKe0cAPc7SzV+huraO/IKIdFy8BQJKxq7oOx9oIyl9Gn+rZ C8faCLn89kZQ== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175490" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175490" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:48 -0700 IronPort-SDR: +HYRDaZDSB4la79UUDgu2F6eqVq2NHxxTtYBan4s0C67LJE2qkl8PxnokRv307JqSs4wOxPFc2 CCb7E+jeMnJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138279" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:47 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 04/12] UefiPayloadPkg: Update the function definition of HobConstructor Date: Wed, 23 Jun 2021 10:52:27 +0800 Message-Id: <20210623025235.3311-5-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: iNL2iq77gH7C9qskUvaW3vRBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416771; bh=cPuad2wtGBUlQkaFVBJaFpxYGNHCSzjJ8Qy01wsyuFw=; h=Cc:Date:From:Reply-To:Subject:To; b=NV4OeChhsbJav39sO5GXrN016aRGjM3LNREW5Mw98lEoHPXCoSfstwaisRDIjJK6UZ8 Io5L8LGjUZdpN7ufB48IU1+P4IBpu6ZbyPOS9fwcsdk7txKb7RxQbXvlNERTPpFcLr38D osuGn/EGQHKMhNZ33ZdDQ59MsiUQpuvRftU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Update the function defination of HobConstructor to align the Phit Hob structure. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c | 26 +++++++++++++-----= -------- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 5 +---- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 16 ++++++++-------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c b/UefiPayloadP= kg/Library/PayloadEntryHobLib/Hob.c index 23a749edf1..768c3db770 100644 --- a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c +++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c @@ -39,14 +39,14 @@ GetHobList ( /** Build a Handoff Information Table HOB =20 - This function initialize a HOB region from EfiMemoryBegin with length - EfiMemoryLength. And EfiFreeMemoryBottom and EfiFreeMemoryTop should + This function initialize a HOB region from EfiMemoryBegin to + EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should be inside the HOB region. =20 - @param[in] EfiMemoryBegin Total memory start address - @param[in] EfiMemoryLength Total memory length reported in handoff = HOB. - @param[in] EfiFreeMemoryBottom Free memory start address - @param[in] EfiFreeMemoryTop Free memory end address. + @param[in] EfiMemoryBottom Total memory start address + @param[in] EfiMemoryTop Total memory end address. + @param[in] EfiFreeMemoryBottom Free memory start address + @param[in] EfiFreeMemoryTop Free memory end address. =20 @return The pointer to the handoff HOB table. =20 @@ -54,8 +54,8 @@ GetHobList ( EFI_HOB_HANDOFF_INFO_TABLE* EFIAPI HobConstructor ( - IN VOID *EfiMemoryBegin, - IN UINTN EfiMemoryLength, + IN VOID *EfiMemoryBottom, + IN VOID *EfiMemoryTop, IN VOID *EfiFreeMemoryBottom, IN VOID *EfiFreeMemoryTop ) @@ -77,11 +77,11 @@ HobConstructor ( Hob->Version =3D EFI_HOB_HANDOFF_TABLE_VERSION; Hob->BootMode =3D BOOT_WITH_FULL_CONFIGURATION; =20 - Hob->EfiMemoryTop =3D (UINTN)EfiMemoryBegin + EfiMemoryLength; - Hob->EfiMemoryBottom =3D (UINTN)EfiMemoryBegin; - Hob->EfiFreeMemoryTop =3D (UINTN)EfiFreeMemoryTop; - Hob->EfiFreeMemoryBottom =3D (EFI_PHYSICAL_ADDRESS)(UINTN)(HobEnd+1); - Hob->EfiEndOfHobList =3D (EFI_PHYSICAL_ADDRESS)(UINTN)HobEnd; + Hob->EfiMemoryTop =3D (EFI_PHYSICAL_ADDRESS) EfiMemoryTop; + Hob->EfiMemoryBottom =3D (EFI_PHYSICAL_ADDRESS) EfiMemoryBottom; + Hob->EfiFreeMemoryTop =3D (EFI_PHYSICAL_ADDRESS) EfiFreeMemoryTop; + Hob->EfiFreeMemoryBottom =3D (EFI_PHYSICAL_ADDRESS) (UINTN) (HobEnd+1); + Hob->EfiEndOfHobList =3D (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd; =20 mHobList =3D Hob; return Hob; diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.c index 19d2a8d3bd..ed956c447c 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -561,7 +561,6 @@ PayloadEntry ( PHYSICAL_ADDRESS DxeCoreEntryPoint; EFI_HOB_HANDOFF_INFO_TABLE *HandoffHobTable; UINTN MemBase; - UINTN MemSize; UINTN HobMemBase; UINTN HobMemTop; EFI_PEI_HOB_POINTERS Hob; @@ -580,9 +579,7 @@ PayloadEntry ( HobMemBase =3D ALIGN_VALUE (MemBase + PcdGet32 (PcdPayloadFdMemSize), SI= ZE_1MB); HobMemTop =3D HobMemBase + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize= ); =20 - // DXE core assumes the memory below HOB region could be used, so includ= e the FV region memory into HOB range. - MemSize =3D HobMemTop - MemBase; - HandoffHobTable =3D HobConstructor ((VOID *)MemBase, MemSize, (VOID *)Ho= bMemBase, (VOID *)HobMemTop); + HobConstructor ((VOID *)MemBase, (VOID *)HobMemTop, (VOID *)HobMemBase, = (VOID *)HobMemTop); =20 // Build HOB based on information from Bootloader Status =3D BuildHobFromBl (); diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.h index 5a1b37be16..1ad7a37023 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -93,14 +93,14 @@ UpdateStackHob ( /** Build a Handoff Information Table HOB =20 - This function initialize a HOB region from EfiMemoryBegin with length - EfiMemoryLength. And EfiFreeMemoryBottom and EfiFreeMemoryTop should + This function initialize a HOB region from EfiMemoryBegin to + EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should be inside the HOB region. =20 - @param[in] EfiMemoryBegin Total memory start address - @param[in] EfiMemoryLength Total memory length reported in handoff = HOB. - @param[in] EfiFreeMemoryBottom Free memory start address - @param[in] EfiFreeMemoryTop Free memory end address. + @param[in] EfiMemoryBottom Total memory start address + @param[in] EfiMemoryTop Total memory end address. + @param[in] EfiFreeMemoryBottom Free memory start address + @param[in] EfiFreeMemoryTop Free memory end address. =20 @return The pointer to the handoff HOB table. =20 @@ -108,8 +108,8 @@ UpdateStackHob ( EFI_HOB_HANDOFF_INFO_TABLE* EFIAPI HobConstructor ( - IN VOID *EfiMemoryBegin, - IN UINTN EfiMemoryLength, + IN VOID *EfiMemoryBottom, + IN VOID *EfiMemoryTop, IN VOID *EfiFreeMemoryBottom, IN VOID *EfiFreeMemoryTop ); --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76891): https://edk2.groups.io/g/devel/message/76891 Mute This Topic: https://groups.io/mt/83730179/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76892+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76892+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416772; cv=none; d=zohomail.com; s=zohoarc; b=mV/4Dlzsk81cI4gSAW2dfsGVNkN1vmukv8XXVaAqkffX2VqycP4fOirWCgUmg2DLaw34V0CeGEoGgjxJy8tooLG8wOm9UH49Kg9sYd7tYVoWhR4B3FI1+mH+5EqPrhTvwbS1a7atI++gIF7NezfmZf4GXwV2uuUwRgp0fQ3pxmM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416772; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=TqNxjV/QWKVV1slmUy5qL3XAJwMTtdbNPmNhSE16PiM=; b=A4tvlMiKHjS59j4wIxyRNM3QJQHKRHtnRm3xsLcMC/raJpPulnGOTbpjsTRA4eJYY4qGuPDRrlQYyxjpCFUEOLZIFzripXJy7k/lycnEAhcWoHInH2SxY5PJZ2dbDmBJIzXeeiw4Rye6htSCbKxEJaz50LCFzXz7mGBv3TRvuwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76892+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416772702464.4084203396793; Tue, 22 Jun 2021 19:52:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id RWZBYY1788612xbGev8Jzm4g; Tue, 22 Jun 2021 19:52:52 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:50 -0700 IronPort-SDR: y5PLKyFJYE7U5Imh+CdeWTaclJYbsmV+jDribJ61dxCbN0KRZ7PiGEj68b7CWy3lddJjrKoWp/ MFUy62ChqL0Q== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175492" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175492" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:50 -0700 IronPort-SDR: 2ATyZX94JmD/ZxNR4SYBYmGcYKhBJBvujqNhCfujoFRrM3L53v8fbDj5J8hOk7yx4KRcr1mIKX 7Xc+qjNvvbrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138288" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:48 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 05/12] UefiPayloadPkg: Create separate Payload Entry for UniversalPayload Date: Wed, 23 Jun 2021 10:52:28 +0800 Message-Id: <20210623025235.3311-6-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: VVtuSVQY33uRYJJ18NgM0oX8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416772; bh=6r0X1RDLaeRiZupYXXzO7LhJxThYXTzY5ti3enLMulY=; h=Cc:Date:From:Reply-To:Subject:To; b=nvW3TXAOyP/91Q712/OLFZOX9KWe9lh6UUD222omMRU8iQOZxNO3eUZgCvKo0Ccnbjs gjmH+NJHr5MsouQjRYddPzBYdlkWPDKbH9kc4ZqGndS1oxBXFkivAFMJqD6mcP+ihkWto DNYLDrXRMC1eMQFv5L/A226a3y8knh+48Hc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This patch create the UniversalPayload Entry based on the UefiPayload Entry. It implements the logic to find a proper memory range to create the new Hob and migrate the Hobs from Bootloader. To make the change history clear, the logic to get the DxeCore will be in the next patch. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 311 ++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 91 ++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++ 2 files changed, 402 insertions(+) diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/Uefi= PayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c new file mode 100644 index 0000000000..66e87bcb9b --- /dev/null +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c @@ -0,0 +1,311 @@ +/** @file + + Copyright (c) 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "UefiPayloadEntry.h" + +#define MEMORY_ATTRIBUTE_MASK (EFI_RESOURCE_ATTRIBUTE_PRESENT = | \ + EFI_RESOURCE_ATTRIBUTE_INITIALIZED = | \ + EFI_RESOURCE_ATTRIBUTE_TESTED = | \ + EFI_RESOURCE_ATTRIBUTE_READ_PROTECT= ED | \ + EFI_RESOURCE_ATTRIBUTE_WRITE_PROTEC= TED | \ + EFI_RESOURCE_ATTRIBUTE_EXECUTION_PR= OTECTED | \ + EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PR= OTECTED | \ + EFI_RESOURCE_ATTRIBUTE_16_BIT_IO = | \ + EFI_RESOURCE_ATTRIBUTE_32_BIT_IO = | \ + EFI_RESOURCE_ATTRIBUTE_64_BIT_IO = | \ + EFI_RESOURCE_ATTRIBUTE_PERSISTENT = ) + +#define TESTED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT = | \ + EFI_RESOURCE_ATTRIBUTE_INITIALIZED = | \ + EFI_RESOURCE_ATTRIBUTE_TESTED ) + +extern VOID *mHobList; + +/** + Add HOB into HOB list + + @param[in] Hob The HOB to be added into the HOB list. +**/ +VOID +AddNewHob ( + IN EFI_PEI_HOB_POINTERS *Hob + ) +{ + EFI_PEI_HOB_POINTERS NewHob; + + if (Hob->Raw =3D=3D NULL) { + return; + } + NewHob.Header =3D CreateHob (Hob->Header->HobType, Hob->Header->HobLengt= h); + + if (NewHob.Header !=3D NULL) { + CopyMem (NewHob.Header + 1, Hob->Header + 1, Hob->Header->HobLength - = sizeof (EFI_HOB_GENERIC_HEADER)); + } +} + +/** + Found the Resource Descriptor HOB that contains a range + + @param[in] Base Memory start address + @param[in] Top Memory Top. + + @return The pointer to the Resource Descriptor HOB. +**/ +EFI_HOB_RESOURCE_DESCRIPTOR * +FindResourceDescriptorByRange ( + VOID *HobList, + EFI_PHYSICAL_ADDRESS Base, + EFI_PHYSICAL_ADDRESS Top + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; + + for (Hob.Raw =3D (UINT8 *) HobList; !END_OF_HOB_LIST(Hob); Hob.Raw =3D G= ET_NEXT_HOB(Hob)) { + // + // Skip all HOBs except Resource Descriptor HOBs + // + if (GET_HOB_TYPE (Hob) !=3D EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { + continue; + } + + // + // Skip Resource Descriptor HOBs that do not describe tested system me= mory + // + ResourceHob =3D Hob.ResourceDescriptor; + if (ResourceHob->ResourceType !=3D EFI_RESOURCE_SYSTEM_MEMORY) { + continue; + } + if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) !=3D TEST= ED_MEMORY_ATTRIBUTES) { + continue; + } + + // + // Skip Resource Descriptor HOBs that do not contain the PHIT range Ef= iFreeMemoryBottom..EfiFreeMemoryTop + // + if (Base < ResourceHob->PhysicalStart) { + continue; + } + if (Top > (ResourceHob->PhysicalStart + ResourceHob->ResourceLength)) { + continue; + } + return ResourceHob; + } + return NULL; +} + +/** + Find the highest below 4G memory resource descriptor, except the input R= esource Descriptor. + + @param[in] HobList Hob start address + @param[in] MinimalNeededSize Minimal needed size. + @param[in] ExceptResourceHob Ignore this Resource Descriptor. + + @return The pointer to the Resource Descriptor HOB. +**/ +EFI_HOB_RESOURCE_DESCRIPTOR * +FindAnotherHighestBelow4GResourceDescriptor ( + IN VOID *HobList, + IN UINTN MinimalNeededSize, + IN EFI_HOB_RESOURCE_DESCRIPTOR *ExceptResourceHob + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; + EFI_HOB_RESOURCE_DESCRIPTOR *ReturnResourceHob; + ReturnResourceHob =3D NULL; + + for (Hob.Raw =3D (UINT8 *) HobList; !END_OF_HOB_LIST(Hob); Hob.Raw =3D G= ET_NEXT_HOB(Hob)) { + // + // Skip all HOBs except Resource Descriptor HOBs + // + if (GET_HOB_TYPE (Hob) !=3D EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { + continue; + } + + // + // Skip Resource Descriptor HOBs that do not describe tested system me= mory + // + ResourceHob =3D Hob.ResourceDescriptor; + if (ResourceHob->ResourceType !=3D EFI_RESOURCE_SYSTEM_MEMORY) { + continue; + } + if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) !=3D TEST= ED_MEMORY_ATTRIBUTES) { + continue; + } + + // + // Skip if the Resource Descriptor HOB equals to ExceptResourceHob + // + if (ResourceHob =3D=3D ExceptResourceHob) { + continue; + } + // + // Skip Resource Descriptor HOBs that are beyond 4G + // + if ((ResourceHob->PhysicalStart + ResourceHob->ResourceLength) > BASE_= 4GB) { + continue; + } + // + // Skip Resource Descriptor HOBs that are too small + // + if (ResourceHob->ResourceLength < MinimalNeededSize) { + continue; + } + + // + // Return the topest Resource Descriptor + // + if (ReturnResourceHob =3D=3D NULL) { + ReturnResourceHob =3D ResourceHob; + } else { + if (ReturnResourceHob->PhysicalStart < ResourceHob->PhysicalStart) { + ReturnResourceHob =3D ResourceHob; + } + } + } + return ReturnResourceHob; +} + +/** + It will build HOBs based on information from bootloaders. + + @retval EFI_SUCCESS If it completed successfully. + @retval Others If it failed to build required HOBs. +**/ +EFI_STATUS +BuildHobs ( + IN UINTN BootloaderParameter + ) +{ + EFI_PEI_HOB_POINTERS Hob; + UINTN MinimalNeededSize; + EFI_PHYSICAL_ADDRESS FreeMemoryBottom; + EFI_PHYSICAL_ADDRESS FreeMemoryTop; + EFI_PHYSICAL_ADDRESS MemoryBottom; + EFI_PHYSICAL_ADDRESS MemoryTop; + EFI_HOB_RESOURCE_DESCRIPTOR *PhitResourceHob; + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; + + Hob.Raw =3D (UINT8 *) BootloaderParameter; + MinimalNeededSize =3D FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); + + ASSERT (Hob.Raw !=3D NULL); + ASSERT ((UINTN) Hob.HandoffInformationTable->EfiFreeMemoryTop =3D=3D Hob= .HandoffInformationTable->EfiFreeMemoryTop); + ASSERT ((UINTN) Hob.HandoffInformationTable->EfiMemoryTop =3D=3D Hob.Han= doffInformationTable->EfiMemoryTop); + ASSERT ((UINTN) Hob.HandoffInformationTable->EfiFreeMemoryBottom =3D=3D = Hob.HandoffInformationTable->EfiFreeMemoryBottom); + ASSERT ((UINTN) Hob.HandoffInformationTable->EfiMemoryBottom =3D=3D Hob.= HandoffInformationTable->EfiMemoryBottom); + + + // + // Try to find Resource Descriptor HOB that contains Hob range EfiMemory= Bottom..EfiMemoryTop + // + PhitResourceHob =3D FindResourceDescriptorByRange(Hob.Raw, Hob.HandoffIn= formationTable->EfiMemoryBottom, Hob.HandoffInformationTable->EfiMemoryTop); + if (PhitResourceHob =3D=3D NULL) { + // + // Boot loader's Phit Hob is not in an available Resource Descriptor, = find another Resource Descriptor for new Phit Hob + // + ResourceHob =3D FindAnotherHighestBelow4GResourceDescriptor(Hob.Raw, M= inimalNeededSize, NULL); + if (ResourceHob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + MemoryBottom =3D ResourceHob->PhysicalStart + ResourceHob->Resourc= eLength - MinimalNeededSize; + FreeMemoryBottom =3D MemoryBottom; + FreeMemoryTop =3D ResourceHob->PhysicalStart + ResourceHob->Resourc= eLength; + MemoryTop =3D FreeMemoryTop; + } else if (PhitResourceHob->PhysicalStart + PhitResourceHob->ResourceLen= gth - Hob.HandoffInformationTable->EfiMemoryTop >=3D MinimalNeededSize) { + // + // New availiable Memory range in new hob is right above memory top in= old hob. + // + MemoryBottom =3D Hob.HandoffInformationTable->EfiFreeMemoryTop; + FreeMemoryBottom =3D Hob.HandoffInformationTable->EfiMemoryTop; + FreeMemoryTop =3D FreeMemoryBottom + MinimalNeededSize; + MemoryTop =3D FreeMemoryTop; + } else if (Hob.HandoffInformationTable->EfiMemoryBottom - PhitResourceHo= b->PhysicalStart >=3D MinimalNeededSize) { + // + // New availiable Memory range in new hob is right below memory bottom= in old hob. + // + MemoryBottom =3D Hob.HandoffInformationTable->EfiMemoryBottom - Mi= nimalNeededSize; + FreeMemoryBottom =3D MemoryBottom; + FreeMemoryTop =3D Hob.HandoffInformationTable->EfiMemoryBottom; + MemoryTop =3D Hob.HandoffInformationTable->EfiMemoryTop; + } else { + // + // In the Resource Descriptor HOB contains boot loader Hob, there is n= o enough free memory size for payload hob + // Find another Resource Descriptor Hob + // + ResourceHob =3D FindAnotherHighestBelow4GResourceDescriptor(Hob.Raw, M= inimalNeededSize, PhitResourceHob); + if (ResourceHob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + MemoryBottom =3D ResourceHob->PhysicalStart + ResourceHob->Resourc= eLength - MinimalNeededSize; + FreeMemoryBottom =3D MemoryBottom; + FreeMemoryTop =3D ResourceHob->PhysicalStart + ResourceHob->Resourc= eLength; + MemoryTop =3D FreeMemoryTop; + } + HobConstructor ((VOID *) (UINTN) MemoryBottom, (VOID *) (UINTN) MemoryTo= p, (VOID *) (UINTN) FreeMemoryBottom, (VOID *) (UINTN) FreeMemoryTop); + // + // From now on, mHobList will point to the new Hob range. + // + + // + // Since payload created new Hob, move all hobs except PHIT from boot lo= ader hob list. + // + while (!END_OF_HOB_LIST (Hob)) { + if (Hob.Header->HobType !=3D EFI_HOB_TYPE_HANDOFF) { + // Add this hob to payload HOB + AddNewHob (&Hob); + } + Hob.Raw =3D GET_NEXT_HOB (Hob); + } + + return EFI_SUCCESS; +} + +/** + Entry point to the C language phase of UEFI payload. + + @retval It will not return if SUCCESS, and return error when passin= g bootloader parameter. +**/ +EFI_STATUS +EFIAPI +_ModuleEntryPoint ( + IN UINTN BootloaderParameter + ) +{ + EFI_STATUS Status; + EFI_HOB_HANDOFF_INFO_TABLE *HandoffHobTable; + EFI_PEI_HOB_POINTERS Hob; + + mHobList =3D (VOID *) BootloaderParameter; + // Call constructor for all libraries + ProcessLibraryConstructorList (); + + DEBUG ((DEBUG_INFO, "Entering Universal Payload...\n")); + DEBUG ((DEBUG_INFO, "sizeof(UINTN) =3D 0x%x\n", sizeof(UINTN))); + + // Initialize floating point operating environment to be compliant with = UEFI spec. + InitializeFloatingPointUnits (); + + // Build HOB based on information from Bootloader + Status =3D BuildHobs (BootloaderParameter); + + // + // Mask off all legacy 8259 interrupt sources + // + IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF); + IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF); + + HandoffHobTable =3D (EFI_HOB_HANDOFF_INFO_TABLE *) GetFirstHob(EFI_HOB_T= YPE_HANDOFF); + Hob.HandoffInformationTable =3D HandoffHobTable; + + // Should not get here + CpuDeadLoop (); + return EFI_SUCCESS; +} diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/Ue= fiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf new file mode 100644 index 0000000000..58ff87d969 --- /dev/null +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf @@ -0,0 +1,91 @@ +## @file +# This is the first module for UEFI payload. +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D UniversalPayloadEntry + FILE_GUID =3D D4F0F269-1209-4A66-8039-C4D5A700EA4E + MODULE_TYPE =3D SEC + VERSION_STRING =3D 1.0 + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + UniversalPayloadEntry.c + LoadDxeCore.c + MemoryAllocation.c + +[Sources.Ia32] + X64/VirtualMemory.h + X64/VirtualMemory.c + Ia32/DxeLoadFunc.c + Ia32/IdtVectorAsm.nasm + +[Sources.X64] + X64/VirtualMemory.h + X64/VirtualMemory.c + X64/DxeLoadFunc.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + UefiPayloadPkg/UefiPayloadPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + BaseLib + SerialPortLib + IoLib + HobLib + PeCoffLib + UefiCpuLib + +[Guids] + gEfiMemoryTypeInformationGuid + gEfiFirmwareFileSystem2Guid + gUefiSystemTableInfoGuid + gEfiGraphicsInfoHobGuid + gEfiGraphicsDeviceInfoHobGuid + gUefiAcpiBoardInfoGuid + gEfiSmbiosTableGuid + gEfiAcpiTableGuid + gUefiSerialPortInfoGuid + +[FeaturePcd.IA32] + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES + +[FeaturePcd.X64] + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables ## CONSUMES + + +[Pcd.IA32,Pcd.X64] + gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ##= SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ##= CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ##= CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ##= CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ##= CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable ##= SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ##= CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbSize ##= CONSUMES + + gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase + gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize + gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop + gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIM= ES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## SOMETIM= ES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy ## SOMETIM= ES_CONSUMES + --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76892): https://edk2.groups.io/g/devel/message/76892 Mute This Topic: https://groups.io/mt/83730182/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76893+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76893+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416773; cv=none; d=zohomail.com; s=zohoarc; b=ETWCzcQSioWbiYjkbTqiOn/Jt4IUxjGPB3w5ROpMcsftdWaWNjVy2XoVV0fXWU6C8DGe9QE+uS8rboZF3LQGEnPJLELX7G5VWx+B3RL7LAVnAX88vccAZchEDSgbYjvJC02wtPYEhbLwfbZ2NnE/V21ljhaV6RYZCQK9g68A4tU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416773; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=XflHRTQlWOU2x/FMEfvKhfaZcKRvspiZ4ukorQlomqc=; b=OThmi3hW3mVg3D6LPPxawaunU/MNkZKd0IfsVxMCtvhSZ2QHYDm9L6QWTfqM1aapB6ApK3qxSfRLegNk3eyjCkBtGoBC1CXc71kyLw4z5VFDDI9fIDGopUFYGzcLnKDIBQUJJbPIzaYjq/lCl/lMx3SkCgmsz1PDSt24UnxvH+Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76893+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416773579629.3981210599878; Tue, 22 Jun 2021 19:52:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id X4hjYY1788612xkcJalzUN2F; Tue, 22 Jun 2021 19:52:53 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:52 -0700 IronPort-SDR: tWEXxAxgpLr8uIyflXkjtIBuO42R8f3ny05yiD+cLpf1Or0JP7Hwl3opyuzz/DN/N4PIdlm8jQ WAu6RYLoDS8g== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175514" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208,223";a="204175514" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:51 -0700 IronPort-SDR: U62OpOOMMryTaGbbjL/KgjuF+XekZWzG7CDNW5p9yanXQXDGqRYrs7l200Q/48HCPpVU+BLm4R gU7tw+/bkulQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208,223";a="487138311" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:50 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 06/12] UefiPayloadPkg: Get and enter DxeCore for Universal Payload Date: Wed, 23 Jun 2021 10:52:29 +0800 Message-Id: <20210623025235.3311-7-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: waaxph8xCopJiiDhBL0DciXzx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416773; bh=fn3Nd6f68sBacBKlwTlkISgOeKA3JLQQ5HSHX6aeo4Q=; h=Cc:Date:From:Reply-To:Subject:To; b=Boe2928Pz2LSpdYL5riKLvuX03If4qh0ovrbQlWpf9wQ3sajcUF2thkWVM0zY3h5gT1 pfdopKSAXI5GknFZuyuvAwg+7mVxmidrpie0VBSHqcKYwWVlevNqhRk0c36zuS6lGVP1r t93ACfqRGHaNXx+zK86qnH1Atp/ei9DClSY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From gUniversalPayloadExtraDataGuid Guid Hob, get the Dxe FV information, and get the Dxe Core from the FV. Also, make sure if there are muliple FV hob, the FV hob pointing to this FV will be the first in the hob list. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c | 47 +++++++++++= ++++++++++++++++++++++++++++++++++++ UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 17 +++++++++++= ++++++ UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 44 +++++++++++= +++++++++++++++++++++++++++++++-- UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 1 + UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c | 4 ++-- 5 files changed, 109 insertions(+), 4 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c b/UefiPayloadPkg= /UefiPayloadEntry/LoadDxeCore.c index de9dbb0b0e..f5d70c59f8 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c +++ b/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c @@ -305,3 +305,50 @@ LoadDxeCore ( =20 return EFI_SUCCESS; } + +/** + Find DXE core from FV and build DXE core HOBs. + + @param[in] DxeFv The FV where to find the DXE core. + @param[out] DxeCoreEntryPoint DXE core entry point + + @retval EFI_SUCCESS If it completed successfully. + @retval EFI_NOT_FOUND If it failed to load DXE FV. +**/ +EFI_STATUS +UniversalLoadDxeCore ( + IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv, + OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint + ) +{ + EFI_STATUS Status; + EFI_FFS_FILE_HEADER *FileHeader; + VOID *PeCoffImage; + EFI_PHYSICAL_ADDRESS ImageAddress; + UINT64 ImageSize; + + // + // Find DXE core file from DXE FV + // + Status =3D FvFindFile (DxeFv, EFI_FV_FILETYPE_DXE_CORE, &FileHeader); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D FileFindSection (FileHeader, EFI_SECTION_PE32, (VOID **)&PeCo= ffImage); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Get DXE core info + // + Status =3D LoadPeCoffImage (PeCoffImage, &ImageAddress, &ImageSize, DxeC= oreEntryPoint); + if (EFI_ERROR (Status)) { + return Status; + } + + BuildModuleHob (&FileHeader->Name, ImageAddress, EFI_SIZE_TO_PAGES ((UIN= T32) ImageSize) * EFI_PAGE_SIZE, *DxeCoreEntryPoint); + + return EFI_SUCCESS; +} diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.h index 1ad7a37023..dff7b6b87f 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -33,6 +33,8 @@ #include #include #include +#include +#include =20 #define LEGACY_8259_MASK_REGISTER_MASTER 0x21 #define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1 @@ -127,6 +129,21 @@ LoadDxeCore ( OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint ); =20 +/** + Find DXE core from FV and build DXE core HOBs. + + @param[in] DxeFv The FV where to find the DXE core. + @param[out] DxeCoreEntryPoint DXE core entry point + + @retval EFI_SUCCESS If it completed successfully. + @retval EFI_NOT_FOUND If it failed to load DXE FV. +**/ +EFI_STATUS +UniversalLoadDxeCore ( + IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv, + OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint + ); + /** Transfers control to DxeCore. =20 diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/Uefi= PayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c index 66e87bcb9b..9d59454486 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c @@ -179,7 +179,8 @@ FindAnotherHighestBelow4GResourceDescriptor ( **/ EFI_STATUS BuildHobs ( - IN UINTN BootloaderParameter + IN UINTN BootloaderParameter, + OUT EFI_FIRMWARE_VOLUME_HEADER **DxeFv ) { EFI_PEI_HOB_POINTERS Hob; @@ -190,6 +191,10 @@ BuildHobs ( EFI_PHYSICAL_ADDRESS MemoryTop; EFI_HOB_RESOURCE_DESCRIPTOR *PhitResourceHob; EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; + UNIVERSAL_PAYLOAD_EXTRA_DATA *ExtraData; + UINT8 *GuidHob; + EFI_HOB_FIRMWARE_VOLUME *FvHob; + UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader; =20 Hob.Raw =3D (UINT8 *) BootloaderParameter; MinimalNeededSize =3D FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); @@ -254,6 +259,10 @@ BuildHobs ( // From now on, mHobList will point to the new Hob range. // =20 + // + // Create an empty FvHob for the DXE FV that contains DXE core. + // + BuildFvHob ((EFI_PHYSICAL_ADDRESS) 0, 0); // // Since payload created new Hob, move all hobs except PHIT from boot lo= ader hob list. // @@ -265,6 +274,29 @@ BuildHobs ( Hob.Raw =3D GET_NEXT_HOB (Hob); } =20 + // + // Get DXE FV location + // + GuidHob =3D GetFirstGuidHob(&gUniversalPayloadExtraDataGuid); + ASSERT (GuidHob !=3D NULL); + GenericHeader =3D (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA= (GuidHob); + ASSERT (sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) <=3D GET_GUID_HOB_DATA= _SIZE (GuidHob)); + ASSERT (GenericHeader->Length <=3D GET_GUID_HOB_DATA_SIZE (GuidHob)); + ASSERT (GenericHeader->Length >=3D (sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA= ) + sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY))); + ExtraData =3D (UNIVERSAL_PAYLOAD_EXTRA_DATA *) GET_GUID_HOB_DATA (GuidHo= b); + ASSERT (ExtraData->Count =3D=3D 1); + ASSERT (AsciiStrCmp (ExtraData->Entry[0].Identifier, "uefi_fv") =3D=3D 0= ); + + *DxeFv =3D (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) ExtraData->Entry[0].Ba= se; + ASSERT ((*DxeFv)->FvLength =3D=3D ExtraData->Entry[0].Size); + + // + // Update DXE FV information to first fv hob in the hob list, which + // is the empty FvHob created before. + // + FvHob =3D GetFirstHob (EFI_HOB_TYPE_FV); + FvHob->BaseAddress =3D (EFI_PHYSICAL_ADDRESS) (UINTN) *DxeFv; + FvHob->Length =3D (*DxeFv)->FvLength; return EFI_SUCCESS; } =20 @@ -280,10 +312,13 @@ _ModuleEntryPoint ( ) { EFI_STATUS Status; + PHYSICAL_ADDRESS DxeCoreEntryPoint; EFI_HOB_HANDOFF_INFO_TABLE *HandoffHobTable; EFI_PEI_HOB_POINTERS Hob; + EFI_FIRMWARE_VOLUME_HEADER *DxeFv; =20 mHobList =3D (VOID *) BootloaderParameter; + DxeFv =3D NULL; // Call constructor for all libraries ProcessLibraryConstructorList (); =20 @@ -294,7 +329,11 @@ _ModuleEntryPoint ( InitializeFloatingPointUnits (); =20 // Build HOB based on information from Bootloader - Status =3D BuildHobs (BootloaderParameter); + Status =3D BuildHobs (BootloaderParameter, &DxeFv); + ASSERT_EFI_ERROR (Status); + + Status =3D UniversalLoadDxeCore (DxeFv, &DxeCoreEntryPoint); + ASSERT_EFI_ERROR (Status); =20 // // Mask off all legacy 8259 interrupt sources @@ -304,6 +343,7 @@ _ModuleEntryPoint ( =20 HandoffHobTable =3D (EFI_HOB_HANDOFF_INFO_TABLE *) GetFirstHob(EFI_HOB_T= YPE_HANDOFF); Hob.HandoffInformationTable =3D HandoffHobTable; + HandOffToDxeCore (DxeCoreEntryPoint, Hob); =20 // Should not get here CpuDeadLoop (); diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/Ue= fiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf index 58ff87d969..77cd25aafd 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf @@ -62,6 +62,7 @@ gEfiSmbiosTableGuid gEfiAcpiTableGuid gUefiSerialPortInfoGuid + gUniversalPayloadExtraDataGuid =20 [FeaturePcd.IA32] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c b/UefiPayloa= dPkg/UefiPayloadEntry/X64/DxeLoadFunc.c index 73ea30e7a2..dec87ee1ef 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c +++ b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c @@ -66,8 +66,8 @@ HandOffToDxeCore ( // // Get the address and size of the GHCB pages // - GhcbBase =3D (VOID *) PcdGet64 (PcdGhcbBase); - GhcbSize =3D PcdGet64 (PcdGhcbSize); + GhcbBase =3D 0; + GhcbSize =3D 0; =20 PageTables =3D 0; if (FeaturePcdGet (PcdDxeIplBuildPageTables)) { --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76893): https://edk2.groups.io/g/devel/message/76893 Mute This Topic: https://groups.io/mt/83730183/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76894+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76894+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416776; cv=none; d=zohomail.com; s=zohoarc; b=FNGKBet+RWQXe+WqW4E5s9GVCsCusE/STlaMsLewR6KCCOk/tErMa9/of02QkROSyvkba9Kh8POOfYV0F3/ZnQfZ+BwTtVq4fjjEZCzFcQXBnXIteBYdY0qyjlVvPxcywoBcm5n39iW2lDSJVKKsVUqesmLv7Zy8dnfiPGU49Q8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416776; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=o0Bg/yZc1BUlOOzVvhQDhQ9FEgMZSNCzla0QIx6DtDk=; b=QVhrHAH8v6jla4Yli6/3IBoWgOZIR8qKatLpNDga5fMn5cWHvdVdHyuVrm6ftmGBqs3houIlg7EnlnOjk0d2HLvFfHPL/k1cRgQ95twvaquDnUXvEnpG+UhFgloUsI08xzkG3J7eGBr6MA79CG/OU1bSeAelHfDuAFogd5u8vCg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76894+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416775951822.8615973262681; Tue, 22 Jun 2021 19:52:55 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id blPnYY1788612xntjFd5YLYv; Tue, 22 Jun 2021 19:52:54 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:54 -0700 IronPort-SDR: lp6FdD/VtN7OTLv9BbsJ711pAXBKBXYxuIx++PM72yYS+Ewvq/ye77oMsdCEbn2fUfCS6wZfzU uDIAMgCFdXaQ== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175529" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175529" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:53 -0700 IronPort-SDR: pPGaGgXIFxDCJHJpfTcTHaeO1uVtLYHqKmosSSzlAnYrJTeddJE7zCivTw3YRNMIU/NSor4HVe wuEIA+JGPEjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138320" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:52 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 07/12] UefiPayloadPkg: Fix up UPL Pcd database Date: Wed, 23 Jun 2021 10:52:30 +0800 Message-Id: <20210623025235.3311-8-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: tlhFOs6bqzNGA9ZLmnPHJa2kx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416774; bh=EnUtTKvyoH/mdv3wTjrsqH/qKPCDRyiZEw7ice9xE78=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=ABAAJmAd36w6tVrutKxbhHI7JIp972Huj3H7tzAEH+51XTtwMdClJ4qyMDTQ0TBnaJc 0+Bn3dQkMgpxkR6XhdbOhtTNId/p5Blse9RVmdd8MtYkOvwlJHaoQ1g5KDPCTEZW611L3 R1ZM6iTmka0La2XJUNfsTs8C+0hv0QMelRM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" V1: Edk2 bootloader will pass the pei pcd database, and UPL also contain a PCD database. Dxe PCD driver has the assumption that the two PCD database can be catenated and the local token number should be successive=E3=80=82 This patch will manually fix up the UPL PCD database to meet that assumption. V2: Update the function comments Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c | 19 +++++++++++= +------- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 45 +++++++++++= ++++++++++++++++++++++++++++++++++ UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 57 +++++++++++= ++++++++++++++++++++++++++++++++++++++++++++++ UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 2 ++ UefiPayloadPkg/UefiPayloadPkg.dec | 2 ++ UefiPayloadPkg/UefiPayloadPkg.dsc | 1 + 6 files changed, 119 insertions(+), 7 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c b/UefiPayloadPkg= /UefiPayloadEntry/LoadDxeCore.c index f5d70c59f8..0b6cb47cd0 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c +++ b/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c @@ -114,20 +114,23 @@ LoadPeCoffImage ( } =20 /** - This function searchs a given file type within a valid FV. + This function searchs a given file type with a given Guid within a valid= FV. + If input Guid is NULL, will locate the first section having the given fi= le type =20 @param FvHeader A pointer to firmware volume header that contains= the set of files to be searched. @param FileType File type to be searched. + @param Guid Will ignore if it is NULL. @param FileHeader A pointer to the discovered file, if successful. =20 @retval EFI_SUCCESS Successfully found FileType @retval EFI_NOT_FOUND File type can't be found. **/ EFI_STATUS -FvFindFile ( +FvFindFileByTypeGuid ( IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader, IN EFI_FV_FILETYPE FileType, + IN EFI_GUID *Guid OPTIONAL, OUT EFI_FFS_FILE_HEADER **FileHeader ) { @@ -171,8 +174,10 @@ FvFindFile ( // Look for file type // if (File->Type =3D=3D FileType) { - *FileHeader =3D File; - return EFI_SUCCESS; + if (Guid =3D=3D NULL || CompareGuid(&File->Name, Guid)) { + *FileHeader =3D File; + return EFI_SUCCESS; + } } } =20 @@ -266,7 +271,7 @@ LoadDxeCore ( // // DXE FV is inside Payload FV. Here find DXE FV from Payload FV // - Status =3D FvFindFile (PayloadFv, EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE,= &FileHeader); + Status =3D FvFindFileByTypeGuid (PayloadFv, EFI_FV_FILETYPE_FIRMWARE_VOL= UME_IMAGE, NULL, &FileHeader); if (EFI_ERROR (Status)) { return Status; } @@ -283,7 +288,7 @@ LoadDxeCore ( // // Find DXE core file from DXE FV // - Status =3D FvFindFile (DxeCoreFv, EFI_FV_FILETYPE_DXE_CORE, &FileHeader); + Status =3D FvFindFileByTypeGuid (DxeCoreFv, EFI_FV_FILETYPE_DXE_CORE, NU= LL, &FileHeader); if (EFI_ERROR (Status)) { return Status; } @@ -330,7 +335,7 @@ UniversalLoadDxeCore ( // // Find DXE core file from DXE FV // - Status =3D FvFindFile (DxeFv, EFI_FV_FILETYPE_DXE_CORE, &FileHeader); + Status =3D FvFindFileByTypeGuid (DxeFv, EFI_FV_FILETYPE_DXE_CORE, NULL, = &FileHeader); if (EFI_ERROR (Status)) { return Status; } diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.h index dff7b6b87f..331724c687 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -35,6 +35,7 @@ #include #include #include +#include =20 #define LEGACY_8259_MASK_REGISTER_MASTER 0x21 #define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1 @@ -159,4 +160,48 @@ HandOffToDxeCore ( IN EFI_PEI_HOB_POINTERS HobList ); =20 +EFI_STATUS +FixUpPcdDatabase ( + IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv + ); + +/** + This function searchs a given section type within a valid FFS file. + + @param FileHeader A pointer to the file header that contains= the set of sections to + be searched. + @param SearchType The value of the section type to search. + @param SectionData A pointer to the discovered section, if su= ccessful. + + @retval EFI_SUCCESS The section was found. + @retval EFI_NOT_FOUND The section was not found. + +**/ +EFI_STATUS +FileFindSection ( + IN EFI_FFS_FILE_HEADER *FileHeader, + IN EFI_SECTION_TYPE SectionType, + OUT VOID **SectionData + ); + +/** + This function searchs a given file type with a given Guid within a valid= FV. + If input Guid is NULL, will locate the first section having the given fi= le type + + @param FvHeader A pointer to firmware volume header that contains= the set of files + to be searched. + @param FileType File type to be searched. + @param Guid Will ignore if it is NULL. + @param FileHeader A pointer to the discovered file, if successful. + + @retval EFI_SUCCESS Successfully found FileType + @retval EFI_NOT_FOUND File type can't be found. +**/ +EFI_STATUS +FvFindFileByTypeGuid ( + IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader, + IN EFI_FV_FILETYPE FileType, + IN EFI_GUID *Guid OPTIONAL, + OUT EFI_FFS_FILE_HEADER **FileHeader + ); #endif diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/Uefi= PayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c index 9d59454486..b8c1317df0 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c @@ -25,6 +25,62 @@ =20 extern VOID *mHobList; =20 +/** + Some bootloader may pass a pcd database, and UPL also contain a PCD data= base. + Dxe PCD driver has the assumption that the two PCD database can be caten= ated and + the local token number should be successive=E3=80=82 + This function will fix up the UPL PCD database to meet that assumption. + + @param[in] DxeFv The FV where to find the Universal PCD databa= se. + + @retval EFI_SUCCESS If it completed successfully. + @retval other Failed to fix up. +**/ +EFI_STATUS +FixUpPcdDatabase ( + IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv + ) +{ + EFI_STATUS Status; + EFI_FFS_FILE_HEADER *FileHeader; + VOID *PcdRawData; + PEI_PCD_DATABASE *PeiDatabase; + PEI_PCD_DATABASE *UplDatabase; + EFI_HOB_GUID_TYPE *GuidHob; + DYNAMICEX_MAPPING *ExMapTable; + UINTN Index; + + GuidHob =3D GetFirstGuidHob (&gPcdDataBaseHobGuid); + if (GuidHob =3D=3D NULL) { + // + // No fix-up is needed. + // + return EFI_SUCCESS; + } + PeiDatabase =3D (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob); + DEBUG ((DEBUG_INFO, "Find the Pei PCD data base, the total local token n= umber is %d\n", PeiDatabase->LocalTokenCount)); + + Status =3D FvFindFileByTypeGuid (DxeFv, EFI_FV_FILETYPE_DRIVER, PcdGetPt= r (PcdPcdDriverFile), &FileHeader); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + Status =3D FileFindSection (FileHeader, EFI_SECTION_RAW, &PcdRawData); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + UplDatabase =3D (PEI_PCD_DATABASE *) PcdRawData; + ExMapTable =3D (DYNAMICEX_MAPPING *) (UINTN) ((UINTN) PcdRawData + UplD= atabase->ExMapTableOffset); + + for (Index =3D 0; Index < UplDatabase->ExTokenCount; Index++) { + ExMapTable[Index].TokenNumber +=3D PeiDatabase->LocalTokenCount; + } + DEBUG ((DEBUG_INFO, "Fix up UPL PCD database successfully\n")); + return EFI_SUCCESS; +} + /** Add HOB into HOB list =20 @@ -332,6 +388,7 @@ _ModuleEntryPoint ( Status =3D BuildHobs (BootloaderParameter, &DxeFv); ASSERT_EFI_ERROR (Status); =20 + FixUpPcdDatabase (DxeFv); Status =3D UniversalLoadDxeCore (DxeFv, &DxeCoreEntryPoint); ASSERT_EFI_ERROR (Status); =20 diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/Ue= fiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf index 77cd25aafd..76d7e4791c 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf @@ -63,6 +63,7 @@ gEfiAcpiTableGuid gUefiSerialPortInfoGuid gUniversalPayloadExtraDataGuid + gPcdDataBaseHobGuid =20 [FeaturePcd.IA32] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES @@ -72,6 +73,7 @@ =20 =20 [Pcd.IA32,Pcd.X64] + gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ##= SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ##= CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ##= CONSUMES diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayload= Pkg.dec index 105e1f5a1c..d84f560995 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dec +++ b/UefiPayloadPkg/UefiPayloadPkg.dec @@ -72,3 +72,5 @@ gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServ= icesCode|0x80|UINT32|0x =20 # Size of the region used by UEFI in permanent memory gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x02000000|UIN= T32|0x00000017 + +gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0= xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 }|VOI= D*|0x00000018 diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index d8277efccd..e3d669a6d6 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -298,6 +298,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } =20 + gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80,= 0xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 } =20 !if $(SOURCE_DEBUG_ENABLE) gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76894): https://edk2.groups.io/g/devel/message/76894 Mute This Topic: https://groups.io/mt/83730184/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76895+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76895+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416776; cv=none; d=zohomail.com; s=zohoarc; b=ZNXMhwAK6/pUZ4fVEYrX+W8ykxLsVVAOHr639fpU44TtNpxFn/BAzhGDVCnDS4mQHJ2VYii7ietE1ULZv5mKGi8y0h/lNSeafFHf/TxNgvQC5fKZQo7N58Qxl0vas+raFlyFrMJjStp+Y0fZ7b1jBOQ1X9JYG/JXwJZVKf4x8To= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416776; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=5sU+XEsCvntP6GOZ5dAaoH4WhSJaGwlDky3ogfTnuNQ=; b=Y59sJviKe21raPvdk+3y6lmz8NkSuWl2gNC4eobSCEX9DSju6x4jizyXC9wMS8rapyCOOvUJQAQi6l/v3sIFMEP37vRMCHug9I6pSYvavTNOULCsrOIh6a9Webx0Y8nahlrJTwBsNmV9tUeH4BnijTkg4bpNsjZDrklCKPu3jl0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76895+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416776489598.2640602081245; Tue, 22 Jun 2021 19:52:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6VY7YY1788612xQFZimsgcsY; Tue, 22 Jun 2021 19:52:56 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:55 -0700 IronPort-SDR: 4+6Jh+JmCJlEQ8CPwy4NTws1n7iuyX4YtIDZH6w+9GmUSS3yfMXLKrQh3U6ulyR/+/sOK8mSuu 6TC0eLg+uv2Q== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175545" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175545" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:55 -0700 IronPort-SDR: L4uF+/94pejJPY5RNNgFMeR2SpMLm/aOgMeoY1i2C2G0b27dBiqnO4W16N4GrNoswqWhDqV4NG qXAPxdS1F7Bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138331" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:53 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 08/12] UefiPayloadPkg: Include UniversalPayLoad modules in UefiPayloadPkg.dsc Date: Wed, 23 Jun 2021 10:52:31 +0800 Message-Id: <20210623025235.3311-9-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: Oym9WHanQKh35ELgE1u0fZZpx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416776; bh=kBzlEM9IZuEzBKk8mPbgcoy4tiFsaOjukoZSKEsUeok=; h=Cc:Date:From:Reply-To:Subject:To; b=UWLCBFIlUG0Skd/CAF3IC711sSO8acH1X6hSzSAkNVd2cVEKke89SIILv18zkJJou+K QrgDSnV8f5eguoPIZ52BOiu2rEFCTUupN5FjNgCq4g3dKdGawtPrm4ypcB8H98/SCglu0 wcAjQ+C2Ww34M9RElACadisW3rL12TyBLIY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add a new macro "UNIVERSAL_PAYLOAD" to build Universal Payload. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/UefiPayloadPkg.dsc | 22 ++++++++++++++++++---- UefiPayloadPkg/UefiPayloadPkg.fdf | 3 ++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index e3d669a6d6..155aea4bc4 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -196,7 +196,11 @@ TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort= Lib16550.inf +!if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE + PlatformHookLib|UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/P= latformHookLib.inf +!else PlatformHookLib|UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.i= nf +!endif PlatformBootManagerLib|UefiPayloadPkg/Library/PlatformBootManagerLib/Pla= tformBootManagerLib.inf IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf =20 @@ -213,10 +217,12 @@ DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf !endif PlatformSupportLib|UefiPayloadPkg/Library/PlatformSupportLibNull/Platfor= mSupportLibNull.inf -!if $(BOOTLOADER) =3D=3D "COREBOOT" - BlParseLib|UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf -!else - BlParseLib|UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf +!if $(UNIVERSAL_PAYLOAD) =3D=3D FALSE + !if $(BOOTLOADER) =3D=3D "COREBOOT" + BlParseLib|UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf + !else + BlParseLib|UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf + !endif !endif =20 DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf @@ -383,10 +389,18 @@ =20 !if "IA32" in $(ARCH) [Components.IA32] + !if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE + UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf + !else UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf + !endif !else [Components.X64] + !if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE + UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf + !else UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf + !endif !endif =20 [Components.X64] diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayload= Pkg.fdf index ed7fbcaddb..6073f9c1b4 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.fdf +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf @@ -52,8 +52,9 @@ READ_STATUS =3D TRUE READ_LOCK_CAP =3D TRUE READ_LOCK_STATUS =3D TRUE =20 +!if $(UNIVERSAL_PAYLOAD) =3D=3D FALSE INF UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf - +!endif FILE FV_IMAGE =3D 4E35FD93-9C72-4c15-8C4B-E77F1DB2D793 { SECTION FV_IMAGE =3D DXEFV } --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76895): https://edk2.groups.io/g/devel/message/76895 Mute This Topic: https://groups.io/mt/83730186/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76896+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76896+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416778; cv=none; d=zohomail.com; s=zohoarc; b=GMGwmn2M0s3E8ffJ6AC7PZL+ZhQOFinVCXTRM1z7Kcco3rg6FdrK4zPqJdzh+vW0lIkXU6wqOYkc93os0xBVj6OruOapdXG8k4LoGiSmdpF3I+i5pHMJOY2o0JFUw+Kx19Ru4/+WemNJpAmgHYw5Z4ezT5MAaXSwmLFrK2gVjJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416778; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=WzdCmmwXmRAdk+fwcseftt+FIW0JYQOBzhBGqx7DVXU=; b=euQgmVDZHhM5IVFr9m3A/QR8/dsDO6owP48WSvdo+GH41vs0dkUb/9JNtl+rsu2PBXmfC2fie07eT+YgJThOCblNGVJ5X8Z2EBQCMfohU801uzZQ6OZARAJzFR8f5cqNEXy9b+zpeQcX0OpCm9sNmLC6nw3/nIGZgCjDhLAHWQI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76896+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416778433278.13417440180433; Tue, 22 Jun 2021 19:52:58 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id U6RJYY1788612x7hekoLV8bt; Tue, 22 Jun 2021 19:52:58 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:57 -0700 IronPort-SDR: rPDc2WCmfEpU6joJqODUtPXtju6Jkaa2+ONfO3DJBUy/Rv1PvVo7TAicUNoHVzUe946PExhrZo v1cB0qmDgO5A== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175555" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175555" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:57 -0700 IronPort-SDR: glNlOkx0cwoH4QXscyR0S2KDGScBQ4Kl8KHVdiqf8M9mFdvWbm0avUcuXMsNgTg9IY3erYInTO Oj8idLDH/ygw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138342" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:55 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 09/12] UefiPayloadPkg: Remove assert when reserve MMIO/IO resource for devices Date: Wed, 23 Jun 2021 10:52:32 +0800 Message-Id: <20210623025235.3311-10-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: mqSiJ0UFYvjC1Twfi8CJH3Btx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416778; bh=NNLiOnzOFQQNlD0SCkAXxsRDXqY2gvL1eDGUEQCYSBI=; h=Cc:Date:From:Reply-To:Subject:To; b=ErV56B1hbmTBYiIMWQwiVzm83eka0ANpnwiGVo3OPPlO8iuvIL6ZdMONqWtuayanNM0 /wQ1WNEi83DKj+Au3tQQ8248z94T8/Hq+Rt3Fz7C8b1epI5wgV8xHa+W/ro2xAfOEJYug VZbRvJWLZ6QS5J2BtihenNlMmZEbOnbBa3k= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Some boot loader may already reserve MMIO/IO resource for IOAPIC and HPET, so remove the assert when reserve MMIO/IO resource for IOAPIC and HPET Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/Bl= SupportDxe/BlSupportDxe.c index ffd3427fb3..04e968a232 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c @@ -41,13 +41,12 @@ ReserveResourceInGcd ( ); if (EFI_ERROR (Status)) { DEBUG (( - DEBUG_ERROR, + DEBUG_WARN, "Failed to add memory space :0x%lx 0x%lx\n", BaseAddress, Length )); } - ASSERT_EFI_ERROR (Status); Status =3D gDS->AllocateMemorySpace ( EfiGcdAllocateAddress, GcdType, @@ -57,14 +56,20 @@ ReserveResourceInGcd ( ImageHandle, NULL ); - ASSERT_EFI_ERROR (Status); } else { Status =3D gDS->AddIoSpace ( GcdType, BaseAddress, Length ); - ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_WARN, + "Failed to add IO space :0x%lx 0x%lx\n", + BaseAddress, + Length + )); + } Status =3D gDS->AllocateIoSpace ( EfiGcdAllocateAddress, GcdType, @@ -74,7 +79,6 @@ ReserveResourceInGcd ( ImageHandle, NULL ); - ASSERT_EFI_ERROR (Status); } return Status; } @@ -106,11 +110,9 @@ BlDxeEntryPoint ( // // Report MMIO/IO Resources // - Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0= xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC - ASSERT_EFI_ERROR (Status); + ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, = SIZE_4KB, 0, ImageHandle); // IOAPIC =20 - Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0= xFED00000, SIZE_1KB, 0, ImageHandle); // HPET - ASSERT_EFI_ERROR (Status); + ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, = SIZE_1KB, 0, ImageHandle); // HPET =20 // // Find the frame buffer information and update PCDs --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76896): https://edk2.groups.io/g/devel/message/76896 Mute This Topic: https://groups.io/mt/83730187/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76897+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76897+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416779; cv=none; d=zohomail.com; s=zohoarc; b=M7/BrUO7J2Z8PjJV3b/689gzYMTWVOsXFJf+KdhSzzifd+TRiqAbRFe8eduIiZ5vrtZBDVUnhdOz9CjO/bOYlaC2+i6izG02LcCos/Wvhpsu6WWZShz+ctM1yMgCg7vg5zcw8UIWrfltaHay2QqPnq72WJkcsybuGY4BP1m/G8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416779; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=xbLqd84lj5qD6sRD3zFk1m7Wf0Z8dRe0Z4mRWFcAguI=; b=EOcFlFRdm4aPuMaWJYUPD4snP64P6LwbPQ9qOZ9tmsDb0tuOitp9SbgkXjFHoODtgVegozjH1C+je11h01JCs4Mq6xbjP+ViyP/zMpKTJW8ss1mHRRGGfEnEuHGWCCXPwAAs4RpYJ28qmMlHTcOaDVSmh8NLfryHCm26QtjzHzo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76897+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 162441677993645.10388431453441; Tue, 22 Jun 2021 19:52:59 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zsuiYY1788612xaqpo0XyBx3; Tue, 22 Jun 2021 19:52:59 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:52:59 -0700 IronPort-SDR: tnh4d32cbiV2kYrrtD3iQ4+EYl5nHUk//5NEaKfWCEwAKZQeVFb+ar1ikOtnW+KcsTiLsd0UGG djueRgp8rBWQ== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175567" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175567" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:52:58 -0700 IronPort-SDR: K84K7NHbxiRcxVBUTlpzUrTqGuKpRuGnmmVyFznxFx51+i7JIZ9cKFZaeKa2hIYTRSj1Nl/hgV 9IwLYKY9W+Hw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138352" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:57 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 10/12] UefiPayloadPkg: Add macro to disable some drivers Date: Wed, 23 Jun 2021 10:52:33 +0800 Message-Id: <20210623025235.3311-11-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: FqgFdi3tBc1smx3rCxiliKq6x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416779; bh=IVnA5es+rYVxm9E609kQyoTPum2bG/Tg1NqM60W0Pr0=; h=Cc:Date:From:Reply-To:Subject:To; b=GQXyRQh7M2n/BZNzgk+ez/sMEY5ujJ1WPMNiB0DwnDGz6eQGaYqxT3rGVOP4+Y0+15Y D9n/GU8e4DGDn36gEeGl39JsN8IlGsSu0jGSGV7SsZs59iTU/zGfhEAF0L9KT8fi7hOYy hi3al/H0cWMDepqzhZCZkg5cqqkf8E7LuG0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" V2: Change DISABLE_VARIABLE to EMU_VARIABLE_ENABLE Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- UefiPayloadPkg/UefiPayloadPkg.dsc | 11 ++++++++++- UefiPayloadPkg/UefiPayloadPkg.fdf | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 155aea4bc4..85055e9091 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -87,6 +87,12 @@ # DEFINE SHELL_TYPE =3D BUILD_SHELL =20 + # + # Disable features + # + DEFINE EMU_VARIABLE_ENABLE =3D FALSE + DEFINE DISABLE_RESET_SYSTEM =3D FALSE + [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES GCC:*_UNIXGCC_*_CC_FLAGS =3D -DMDEPKG_NDEBUG @@ -431,10 +437,13 @@ MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf +!if $(DISABLE_RESET_SYSTEM) =3D=3D FALSE MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf +!endif PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf +!if $(EMU_VARIABLE_ENABLE) =3D=3D FALSE MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf - +!endif # # Following are the DXE drivers # diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayload= Pkg.fdf index 6073f9c1b4..4d186692da 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.fdf +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf @@ -105,9 +105,16 @@ INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTi= mer.inf INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRunt= imeDxe.inf + +!if $(DISABLE_RESET_SYSTEM) =3D=3D FALSE INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf +!endif + INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe= .inf + +!if $(EMU_VARIABLE_ENABLE) =3D=3D FALSE INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf +!endif =20 INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76897): https://edk2.groups.io/g/devel/message/76897 Mute This Topic: https://groups.io/mt/83730189/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76898+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76898+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416781; cv=none; d=zohomail.com; s=zohoarc; b=oG+/eP1LcB5XjnyOr1kblgzniY7NxSvEXcqdQhIC2jzGSff/f9b0D2r/u59B2Eco1tjGTgEBk5pzi6kbd4kwwM2kszmp1Y2rCz8g0aexiYs+LehlxuYqHVRHVPpqnMAuiURZ0avBWvf3aZa5l3Nv5zrZBCVO9IqLrYmndUNgcpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416781; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=rjn616IylYCTff3aiaoBboyuUYy7Gi1lpLQj8r+1bvg=; b=abNizwPpRVk8EUlmc1uxnhQ597DH+WfASKnWIwVSJYIcoSxdBtSPGC1RmqkHouTLeJbZZMgBqefypgR90SU6yOVwa3wkYLE1NsKcCBfuR2ZwWBnHNGHnm+H+TlFfMInLjjC4wz1PyhuVD1JCJ9MNxrxid6Wml5TDMBy9gPi/62M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76898+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416781716916.696390230633; Tue, 22 Jun 2021 19:53:01 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id M9LJYY1788612xZ8zKrLg3ld; Tue, 22 Jun 2021 19:53:01 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:53:00 -0700 IronPort-SDR: bc63wfH8pUA/PE0pwqnDScAa2bQMtd2cCrp4ek23GJ3aN6mjkVF4moqwCOpx3t/U1k83MUH7KX LKBSpkfmKGiA== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175569" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175569" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:53:00 -0700 IronPort-SDR: NvjTrWPKpxlnaW16ti57MZmDUzx4cRkpMPWF6VoEYJv52PLrpXyixBImlNCXmMLKPBFF+Zhdno 4A9Gv4ksLVIQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138363" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:52:59 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 11/12] UefiPayloadPkg: Add PcdInstallAcpiSdtProtocol feature in UefiPayloadPkg Date: Wed, 23 Jun 2021 10:52:34 +0800 Message-Id: <20210623025235.3311-12-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: ELtGLuBw8oXb21re0YeBHqlux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416781; bh=F/4icUkj4DZWTtMmCxP/UkoOxbQpyGsJn5dXU5H7mL8=; h=Cc:Date:From:Reply-To:Subject:To; b=hCdtq9Voo9R0NcNUnigPn/I230x5d4/RQqEIxRVywy6K2SccmYtXth94mfgWf7S4gll RcoyzBDgSbj0VqD64aIRCDVBqxTrpwzGA+R3hjEROUb4PPCFsRDXwMygeoRvLyCBlsugl AHf4NU6GdoJtnse8oeq49PMscu5LZMDkEzM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" To install ACPI SDT protocol, define PcdInstallAcpiSdtProtocol as TRUE. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 85055e9091..c0de7fc734 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -290,6 +290,8 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + ## This PCD specified whether ACPI SDT protocol is installed. + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE =20 [PcdsFixedAtBuild] gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x10000 --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76898): https://edk2.groups.io/g/devel/message/76898 Mute This Topic: https://groups.io/mt/83730191/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 11:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76899+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76899+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624416797; cv=none; d=zohomail.com; s=zohoarc; b=ZeqlCbGyrGa69iIpgRXIZwrWXbzvntJurpC6XrqiT9YDPWCQ3hlROZk9g9tIuNuVCWffvfZ3AlM8dLuZJbyO73Qoo0pRa+orHW/9A0kXMXFbjQZSIb0GTO3U36dyfT8hVVg81Fz7lkPjfh7yHua3tcLBYNJ+t9YR9Tt4x4Vwl4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624416797; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=w+DvEjQ3PQlItn2RgXY3rQ5i+r5wkVVzTLBxK8M1oDk=; b=cbl7Jv2foTuL0/eF8IwipdXqwOPIfhcRBYUPkExcXGVAp6byeHsei3PXZF5rPqhuSDsUko0BguyJGDAH0VMREs8xrjezgGm+OfIgbwCOqzIQxLBWb8GwnmWbVXhuGICTDyeO2EJe4GbnFM6K3LONS6OAUsU8RpjDDlRusS2mmHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76899+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624416797787410.94218969726546; Tue, 22 Jun 2021 19:53:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id up0gYY1788612xOqDdW6JjHh; Tue, 22 Jun 2021 19:53:02 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2469.1624416764968334886 for ; Tue, 22 Jun 2021 19:53:01 -0700 IronPort-SDR: NbV3qo+Wa8uU3mTv5764fn3uP1YG1s4EGrpwcXDc1o6BigeLRrthFHLMHehg/VHISWm9sOnu13 p164UHj5Zp1Q== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="204175570" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="204175570" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 19:53:01 -0700 IronPort-SDR: vbJWKfmwPUPh3bmwJqzEg14Q+zHpRK2q6L8vu1TKp6pa5bK2QHUXNYlGq4sO/yNBVmQrO9+o9O ObD3/u+ChBlw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="487138381" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 22 Jun 2021 19:53:00 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 12/12] UefiPayloadPkg: Add PcdResetOnMemoryTypeInformationChange in UefiPayloadPkg Date: Wed, 23 Jun 2021 10:52:35 +0800 Message-Id: <20210623025235.3311-13-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-1-zhiguang.liu@intel.com> References: <20210623025235.3311-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: DaGDD6h1dO081vh4bgiSELF8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624416782; bh=ATYJCtsW6pcKHeckO0ZGsn+2lE2+fjeUc58D6N616qc=; h=Cc:Date:From:Reply-To:Subject:To; b=fOHmdGmutCvBgjfwzvduCuD6UET/lkdUHerLLbtRG2u7GsKIFJF5GYdJMJHVJSZiqTP mdFaRHF+4e2F6hvMEgQG6JVuNMmht/3OgAXqCYJPiuJId1D61lTPhVOsBdD6lf7dm2AfT 3+alW7vpMgYvxZ01/WFUk3JakhjPS+ZqAIw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This PCD will be consumed by Universal Payload Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/UefiPayloadPkg.dsc | 1 + 1 file changed, 1 insertion(+) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index c0de7fc734..35d714a6f9 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -362,6 +362,7 @@ ##########################################################################= ###### =20 [PcdsDynamicExDefault] + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FAL= SE gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0 --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76899): https://edk2.groups.io/g/devel/message/76899 Mute This Topic: https://groups.io/mt/83730192/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-