From nobody Sat May 18 05:04:50 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+76776+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+76776+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204039; cv=none; d=zohomail.com; s=zohoarc; b=JHs914QV+i6B9F5tBWuP1pKZGdVwQrIwl+zvasXg0D61+WDsu7DU9EUhPmG9KryYlYp1wBcsN14HvTIVooOylKgE4s6T6VwMSK7b4kzyWJE0lAa3/oHSk01bZkdbbn/qs0+xLLd267O73fROhaaB6vqUyS0933u8n3q61FpQReo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204039; 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=vUGNfVw074Nh1Tqs3/F3S/byNOTZ4Pm6w/oY3djrCgY=; b=eRB1FQjtoTWaRecaqSn6ZZwBQq0oBYtf/mmv+hqcxOG8PPfvt93QrLxXqrMCfaaPz3ZDqfPSWyhP0gXM+078lXxx3y5sY265d+rhU6nnxFBSLoXVhoDm0VWBZO4MHRvbFz89B5YJ56GOYGETy50CuGsrg44FpZDyJc7Ogmcwo1s= 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+76776+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 1624204039340600.2400582838932; Sun, 20 Jun 2021 08:47:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id njxyYY1788612x6j0FJSYSdG; Sun, 20 Jun 2021 08:47:18 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:18 -0700 IronPort-SDR: t/YQ6y/DZCP0J/RZObT1dXnT3fEbEoYyJRRBhAp8fls+zfOg/ufTJsk/zex9cc2HP6QRgkzCGs p8t16OP5w+gQ== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044377" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044377" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:17 -0700 IronPort-SDR: MytBPUuoo2Y2NNKY6lZNnTYOhCtquedgaVOmSPn+y8zn2VwROGhjHr+SH4nkHwZrrDdE77zdxn HXtU5sh4wELA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932606" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:15 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You , Ray Ni Subject: [edk2-devel] [PATCH 01/12] UefiPayloadPkg: Add HobLib for UniversalPayload Date: Sun, 20 Jun 2021 23:46:51 +0800 Message-Id: <20210620154702.2681-2-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: 965GMfWCZmCBYPHO8SmfgFD4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204038; bh=djdE5yhLR1VIYVJ1qYChUG7pej0EPJ6uQSccHLaxngo=; h=Cc:Date:From:Reply-To:Subject:To; b=G4qDT/jX5+sRgZ5phfw2rFmqj5E928R4ANatqk/mQ9hzyhJxUdnYlhuhsC4nSndr62y KaMXhB4JzSBUNvTzyieBtj8/twBjaSAyX4JGhmE79R0Jmi9gXeLx1bsFKxv5c6W4lCO3a SV5ZoNB0EY3MY/6kExjaW+g0QivUTfYTCpE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Signed-off-by: Ray Ni Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/Include/Library/DxeHobListLib.h | 27 +++= ++++++++++++++++++++++++ UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf | 40 +++= +++++++++++++++++++++++++++++++++++++ UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni | 17 +++= ++++++++++++++ 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, 843 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..a146befd25 --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf @@ -0,0 +1,40 @@ +## @file +# Instance of HOB Library using HOB list from EFI Configuration Table. +# +# HOB Library implementation that retrieves the HOB List +# from the System Configuration Table in the EFI System Table. +# +# 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 + UefiLib + DxeHobListLib diff --git a/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni b/UefiPayloadPk= g/Library/DxeHobLib/DxeHobLib.uni new file mode 100644 index 0000000000..f1a18b7984 --- /dev/null +++ b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni @@ -0,0 +1,17 @@ +// /** @file +// Instance of HOB Library using HOB list from EFI Configuration Table. +// +// HOB Library implementation that retrieves the HOB List +// from the System Configuration Table in the EFI System Table. +// +// Copyright (c) 2021, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Instance of HOB L= ibrary using HOB list from EFI Configuration Table" + +#string STR_MODULE_DESCRIPTION #language en-US "The HOB Library i= mplementation that retrieves the HOB List from the System Configuration Tab= le in the EFI System Table." + diff --git a/UefiPayloadPkg/Library/DxeHobLib/HobLib.c b/UefiPayloadPkg/Lib= rary/DxeHobLib/HobLib.c new file mode 100644 index 0000000000..8a2e773c59 --- /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 such a HOB from the starting HOB pointer does not exist, it will retu= rn 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 such a HOB from the starting HOB pointer does not exist, it will retu= rn 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HO= B 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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() because PEI HOB is read-only for DXE pha= se. + + 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.16.2.windows.1 -=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 (#76776): https://edk2.groups.io/g/devel/message/76776 Mute This Topic: https://groups.io/mt/83669551/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 05:04:50 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+76777+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+76777+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204045; cv=none; d=zohomail.com; s=zohoarc; b=SQ6TP7K4j6tyoAOXXGzDfnH2WFj/iOCOl6LklFZKfPFrrthobuCJ1A1Gh3QB+/wWAsMIILn9SKdnmaMi3FKgiKYZGxPi3D5Z5lTgmAnRpQ1EX85pPjKE+7DZYUSXnM4mC2kc1APFPyFefm2vxnQVZeSvEJCYn0Ch9OTgr7QUdMk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204045; 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=lCoyxyRgbyAruscdWNjlzSpTr7sPctJXE72Jo2B35RE=; b=MigMdM8Tmj6N0zxhJ5ZUAzUZEtCCyOUj8/lXCT+lz00OCO9icTS0eMtAJtTImo3x27mC0QjaCaDAFVWX6JsDQvP/R2kO65FuX1r++iVXO4Me7gbKm6mdvZBMWUSZLx9dM9SYP3MScjNIbNJSoEm7OxpAgQXzTQWvIzZEBSeJ4GQ= 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+76777+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 1624204045206936.539083299989; Sun, 20 Jun 2021 08:47:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9DQYYY1788612xqSqUp1Mr73; Sun, 20 Jun 2021 08:47:24 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:19 -0700 IronPort-SDR: QRwHvgGi528cqcsO7JNZBk0ZObiuqQLFPn/geMxvC8ntwOWl+b98YI3C5cJbn1UB4y1QEKjxak Ohx+ZkzlwXtw== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044387" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044387" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:19 -0700 IronPort-SDR: NxoKZcQMVrFnv9usmCEVay9pwOKu37MbqxVF7HZP0qArOd/P4KrLblHkbo+/cFK4/X9iEFkeIV jdGpn9E195gw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932611" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:17 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Ray Ni Subject: [edk2-devel] [PATCH 02/12] MdeModulePkg: Add new structure for the Universal Payload Serial Port Info Date: Sun, 20 Jun 2021 23:46:52 +0800 Message-Id: <20210620154702.2681-3-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: yEbRbXVAuJXLdCsRCLE2L8l5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204044; bh=vn3XiPdKw+LzpM/+ls7loP4Hh8PwRDSS4V61yYif9uA=; h=Cc:Date:From:Reply-To:Subject:To; b=nZKv4sFUMsH3nkzqHMKWNFrU6GaBGH2PQ02SNlXX6v+Acq12You9LoYmbV7PBx35KLr GjTEZM/xUV4sq5C2hPqTDlPl9mzb4pCr15edf+YjTbwhKiMAcLcF8vKLQu6ijdIT9xNVv gLbBF+ATN5g2g/x2tzI3a+ogTvkz5z5oFxY= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Hao A Wu --- 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.16.2.windows.1 -=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 (#76777): https://edk2.groups.io/g/devel/message/76777 Mute This Topic: https://groups.io/mt/83669553/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 05:04:50 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+76778+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+76778+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204046; cv=none; d=zohomail.com; s=zohoarc; b=J86nbkziGiH49L+9coFlyKB+pf6ZQK+4Jj6/rwN9RZgv5XuLVzlG1lCVlXjFkdLVmNHFD4NAPz0jngoSNjsXopupweWN/jGByfOTsbX6Ulh+0c6acP9W93JJTrTrOHLbZIt5NP2hEHthejxj0EYXTcH8z77dMS17J/kxX86iwU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204046; 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=xU50LQDuR0wIEdRV8mUmMQF1wTLyLH+cl1VMaJR4XAo=; b=mb+g5kz251sq4Iw00n9R9ir8e0h/r5KuIKNHcrcN/Rmga5nfmp2sdjyjo+qMs0SoTH1V96KVAPqB7Y6LRJULxvLYwC11DVtXNWVPCtrGzE4P5Wq7kISnHIBYyMgZpviD0H1H6iGTrunSwMZwt9nZt21F40+WEvDIAV9s5LawJvc= 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+76778+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 162420404658429.119012635618674; Sun, 20 Jun 2021 08:47:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ENU7YY1788612xUilUmCHus0; Sun, 20 Jun 2021 08:47:26 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:20 -0700 IronPort-SDR: hG+mc5N9SXpcwdhW5o0gwVRLeAClmieJTzzB7RmWTpvWhlT0/2b/nA6+d7Q/3BuVODxxZz6R/4 U1joaxZjuhHg== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044400" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044400" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:20 -0700 IronPort-SDR: 6VFwWvQYzPMnrdNCZJT8C7yg+6YrMk467JV5HIZXfbJVO94KbYG81u/82o5zbsva0I/8MSNYQH 7SZHfg3fAkLA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932615" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:19 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 03/12] UefiPayloadPkg: Add a separate PlatformHookLib for Universal Payload Date: Sun, 20 Jun 2021 23:46:53 +0800 Message-Id: <20210620154702.2681-4-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: aW5utDWi6Z96DguTBZuanvGox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204046; bh=Y+oGqlXYtRwXUgpRB70vhZ++cAypenwGCPO3tgMAm4Q=; h=Cc:Date:From:Reply-To:Subject:To; b=jW8b04YYZ8+5D6BxtEtCbUvDfS4QJSoOk839GkNTMa82QAfJSimJlqrnuIGjAWmLSCx BmPLWMbqTpBsLG8e5wr7vReyf6JlclFdtInKpBgnejhxH3m3kbZ9uE+NM0gnUyaIM6D+W fJUrMrPhl3rr6FLbCBq/kU+quJM1m3mId3E= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- 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.16.2.windows.1 -=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 (#76778): https://edk2.groups.io/g/devel/message/76778 Mute This Topic: https://groups.io/mt/83669557/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 05:04:50 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+76779+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+76779+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204048; cv=none; d=zohomail.com; s=zohoarc; b=P0IHsBDwUOtMHKbihYWnAPWi4FpBf94/f4R/fZLgP9l8WQFfuWemCtVz+vl9zTgGCt/oFxjr1vt9wdcz+qV4bgonXLHlTSxFOC2IJd3Uf2kOVIKQpFeGGdgMCSMWWQas0hIoL9bMYFAV0u+SoqDI8aJNviLdYteY0khnTqfLmIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204048; 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=67BQWCp0Oy716q96Ww4jHQcKHXkyOXbUPwhNgsLVhuA=; b=fpwYwb6VSJRvFaBD35DyVFMztH+PhgVPWJgOPKBqWRv6XCOhJ2ZfJ47T9IYYtlAVYZtNF+x/TvgFdBrIvzyvmYwGhkup6I0VsnTZ9J20AVRtkYIYdg6NmkZe+WMtRv4OvOGJWuV0G+1f+11CT8ERjHS4z/xjzl+De1XE+FGaa9I= 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+76779+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 1624204048637103.97455617646335; Sun, 20 Jun 2021 08:47:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id dVGYYY1788612xHPz4KdPIJK; Sun, 20 Jun 2021 08:47:28 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:22 -0700 IronPort-SDR: fMsHUU5Mbc/SBkHdy6b66/QeDumO9jjfgLe/A9SiOJ7maEn0zoRoGJ86KPq2VfZUGFJD8bGaEj BJMp6WS64XoQ== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044409" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044409" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:22 -0700 IronPort-SDR: xMLII2eKpARRNKiD+ZDc+wb8pWE77jgwdZg7A2XVjl5JBpTJuUNHGhecxGW/jjNvbuKj0h0Raa blUScZrJ97xg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932628" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:20 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 04/12] UefiPayloadPkg: Update the function definition of HobConstructor Date: Sun, 20 Jun 2021 23:46:54 +0800 Message-Id: <20210620154702.2681-5-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: GmPgNGC4CdpX8CYRjCDvSMzRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204048; bh=Qkm5ayhN7ZVcupwt648V/J4MyAQr1gODR2DnGN/stb4=; h=Cc:Date:From:Reply-To:Subject:To; b=iKS7+wnVLyh4m91twjVDwqE1hw+MLaX0h+Nj8PAzGcktVGoAdlxoiqUQzQjKhC5/K0V 9USKYB4ejjq/ff4h3fNDKpWcmuRDHkrDX6CV2MoItk1AosHtbnbZgNA/anF7rFBq8wJWA dfpZ9XPQcZeInRR8ThDvTYljvDjrGBcm5Jw= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- 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 8c6f7e326f..4308936d63 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -382,7 +382,6 @@ PayloadEntry ( PHYSICAL_ADDRESS DxeCoreEntryPoint; EFI_HOB_HANDOFF_INFO_TABLE *HandoffHobTable; UINTN MemBase; - UINTN MemSize; UINTN HobMemBase; UINTN HobMemTop; EFI_PEI_HOB_POINTERS Hob; @@ -401,9 +400,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 a4c9da128e..e9c3ec3073 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -83,14 +83,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 @@ -98,8 +98,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.16.2.windows.1 -=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 (#76779): https://edk2.groups.io/g/devel/message/76779 Mute This Topic: https://groups.io/mt/83669558/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 05:04:50 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+76780+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+76780+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204049; cv=none; d=zohomail.com; s=zohoarc; b=hcvA/1QJRQ0ltS02NW3ncwGh9Z+fIBa+QRJEfFPrLxdF3Pwp1gDAx5plycZnPYYs1ikFv73WB9EIYLb/4SQUtnRYdYkW+k1TOZJZEc6ypqPeZT843N4QNuKHtsjXKKcwjtpVec/joDlbEE3IoRFPp/e2Vs3rN6WMPQayDyu6h9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204049; 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=1u9xkX9H7vQs6v2AXukNmq9V0aYg1FY6QTUz6IF2Aa4=; b=B5cxfeF2HCJIbhurTBFKNAfTkGy/Si0CAwyWZ1kxEDWe0v49/84YXhsfENRyRUuEcu5uPGABDHrXtdVMtiMZzq2NWo+fgw3WOsVTsWcF+6+41Stb9uDyBrKuJ/X3T413unjWoTZWNRQn2FJ3tctdX9CBKboL0/opf0BKn6UH+Hk= 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+76780+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 1624204049377342.5847232323597; Sun, 20 Jun 2021 08:47:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zr4MYY1788612xxMs03jdyGF; Sun, 20 Jun 2021 08:47:29 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:23 -0700 IronPort-SDR: ZKGb13Ok3oTVEaab9eqdAma6m0oVOwgzwf+rhTZOtPk9cJUJq/IaXYQpwzc7gsjrfBrbe+ZTUx CunaErTMtV2g== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044414" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044414" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:23 -0700 IronPort-SDR: 3/hhPfYHXPtb/OFzOF+E9HLMIf3ITePxh8ul/4DajABwTKsjVYVnPOXY8er85zIE9A8lTxNf2D 0nZ32+DqdhWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932640" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:21 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 05/12] UefiPayloadPkg: Create separate Payload Entry for UniversalPayload Date: Sun, 20 Jun 2021 23:46:55 +0800 Message-Id: <20210620154702.2681-6-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: 844NvkPLxPrKcpkzOeyGlED2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204049; bh=8/SHNy15wr63FGOegyjEuEMp5b50EFq4aTDkTIbIfCM=; h=Cc:Date:From:Reply-To:Subject:To; b=XccisKPSi9L9gBJdxTBlZS8cG2Zg5Rw4iRDfDCutYZRrU+yevopVwoyTN0ShpbGywpX +uoIqJRLhmgORT7l+1w6VFoQpEbBfMa3fvGyKCVV4sdZnQNSBjImOKhaFSuaa2PTPYEkS GeQ+mgrjEfqD8ocalu+kROXoglFB6xvzIOc= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- 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.16.2.windows.1 -=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 (#76780): https://edk2.groups.io/g/devel/message/76780 Mute This Topic: https://groups.io/mt/83669559/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 05:04:50 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+76781+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+76781+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204050; cv=none; d=zohomail.com; s=zohoarc; b=OVp/wc+ldDKTw09A2rqRApNJln1WVYPArKopxrP0diz6UEgSC4D+pi5mL1JuB0UmagJDVcWQ5QKXVGKtF/2U0eMGd8Do+LNJpc+u3s/vSCTLGSowHNxNruM4tBtvEU1N5X6AY5MWTh1PYGPGggz3lrcClERS0kgnm7/YdKG6whU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204050; 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=UgIS2dNfxlBC+pB35zfpuk67RE9G6nCcF8TCevxPXxk=; b=aWoLOZWnlPFpiBOskOCZX6vi5u01BBwbUN+vc8QBWphF3xpZF7vW1beOhWV8XBx+TAwC1zwjI8gxv7qVZN/YJHV6LGfGoTpDnlakoUQ9xuqnf2so58qZerg2TQk2dyJ/1CVbC7SdJIHXqgOxjzet6oA481wSKsnSquBbuBZP2SU= 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+76781+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 1624204050854326.93154879335384; Sun, 20 Jun 2021 08:47:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id nrvkYY1788612xrjuNEnpyjP; Sun, 20 Jun 2021 08:47:30 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:25 -0700 IronPort-SDR: pzoRrnLBZhQSUo7X50rQiOIfXll7etrbBvUA+KpGazmlnz0xPSGulj8UO4uJYH+RkXbW8TaI+f 2Wbc3VAl53lg== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044416" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208,223";a="194044416" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:24 -0700 IronPort-SDR: MuFXSmX+j4mwYqI24lGLmQPOV+M7CvskXuRhuMnUgZ0zrTd3ciEdN7zeXLHrbnKHXzWARmK47m eM6IfPzgOeQA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208,223";a="451932647" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:23 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 06/12] UefiPayloadPkg: Get and enter DxeCore for Universal Payload Date: Sun, 20 Jun 2021 23:46:56 +0800 Message-Id: <20210620154702.2681-7-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: 0TK0kHZM9X28YLsLPx6DGfxmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204050; bh=IqU0O91LZ59zTmgTxAG0v3wTrB//trBaZieuDB73GDg=; h=Cc:Date:From:Reply-To:Subject:To; b=vuCQzvHw0wwtTKfimhFr0Z2RrKR31o6LFVuSxbBHPCOOuSfcq+WmO5cjRoqW3eY9aAT aSZua4B984JFbmt4AjKCn42pJ6/lDVnflXwZ7GsiXTrzbd3x5peyGUATcqWrasg88ZCLK YRIwkb4q0vMISlofRIBD0aV3boTL9eUyiMA= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- 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 e9c3ec3073..35098f5141 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 @@ -117,6 +119,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.16.2.windows.1 -=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 (#76781): https://edk2.groups.io/g/devel/message/76781 Mute This Topic: https://groups.io/mt/83669560/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 05:04:50 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+76782+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+76782+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204052; cv=none; d=zohomail.com; s=zohoarc; b=cC/XVsVfjub9MCjkCPoMBGWwhRsCHGpaxnbCvO+/eQh15cFL2e440Tdp4D5BNq6qOwGcSfJ3ybfXhtqDijFmICiXSPCbC+MW1wJgUc1KIj9nVHl+baxY4/PsdvUOisiJYnp3YJE9tuoTY+1BCZXJXsBpGWbjGmBJh7M4weajlpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204052; 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=apCSmG+uoYEbMZv5uxj4eAO6k/Q6GjI4v0VvyJUX8TY=; b=fyUEzbb/6CbF3c24+aby2nZt1N8LZ/MfluJWm2oE3knFb0xVmVbEM8+KdI1qXX6zSKHY3yN4yxEM8lF4l76FduYq8NSx60B9aPdFJQpqTuaNQ2uQnla0LYC/BrHoqUmb2RZ9nrMNXqRvdSQxDekT3FfyUCiMGPTWds+8yKIJzts= 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+76782+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 1624204052161601.3727717364758; Sun, 20 Jun 2021 08:47:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3hfQYY1788612xG1mbhUqJoi; Sun, 20 Jun 2021 08:47:31 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:26 -0700 IronPort-SDR: BE7XssR+TiFNipqU7OqWGcFkOqN5d59XTkOUOK5tqwPuiPkMV5GLMkBNqNAbmHmqvlBh11INdf qcBE7r9JVWKw== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044428" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044428" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:26 -0700 IronPort-SDR: N3+r+a9O6aImsNxnh9yh1umacqhpizM08BYUURnSCKvPMSV1VaqvwI6hhszSYfQTvzyGPmY07o tNPzIuX9iH3A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932653" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:24 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 07/12] UefiPayloadPkg: Fix up UPL Pcd database Date: Sun, 20 Jun 2021 23:46:57 +0800 Message-Id: <20210620154702.2681-8-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: ZkLRdVmixSxgTAcPINASO2REx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204051; bh=qJ6rugLdGDFX6T8Hgv9Ul1658ljTyhGXad6HkyTTyds=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=EXXYTL3yQ1Sjb3IfYEvi+tM8QFuAk60bP1vmPfQqL0UOdVFY+o1W9JlVhZxwC6H35PC f9Ez1P6uYITebBqSFWkDLNcbnCS+uzBGGCYHjS2pIWPI1XNsHB0cMMTWBblOY/PAv+sqP ewomFJc2pY66oUJeTzGZQO12yy7Q4PVD9uI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c | 18 +++++++++++= +------ UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 45 +++++++++++= ++++++++++++++++++++++++++++++++++ UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 55 +++++++++++= ++++++++++++++++++++++++++++++++++++++++++++ UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 2 ++ UefiPayloadPkg/UefiPayloadPkg.dec | 2 ++ UefiPayloadPkg/UefiPayloadPkg.dsc | 1 + 6 files changed, 117 insertions(+), 6 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c b/UefiPayloadPkg= /UefiPayloadEntry/LoadDxeCore.c index f5d70c59f8..f943a2632c 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 ) { @@ -172,7 +175,10 @@ FvFindFile ( // 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 +272,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 +289,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 +336,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 35098f5141..78a67fa1a5 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 @@ -149,4 +150,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..dcf750befc 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c @@ -25,6 +25,60 @@ =20 extern VOID *mHobList; =20 +/** + Find DXE core from FV and build DXE core HOBs. + + @param[in] FvBase FV base to load DXE core from + @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 +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 +386,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.16.2.windows.1 -=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 (#76782): https://edk2.groups.io/g/devel/message/76782 Mute This Topic: https://groups.io/mt/83669561/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 05:04:50 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+76783+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+76783+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204053; cv=none; d=zohomail.com; s=zohoarc; b=JF/Hs5gaPruNEXFxZYlYKtV0UgEwsk3vYBdM829nO4JICsY95ji0GSNZuxMZPaOwXsX2bpQoQgNCbBi6BRfh4VpI+UVFNP1WGPVI802MeRGWj2UPwbo6gtPkmt7xYRYo/jfJSAu8TcVjJhpiDe6YEh5uPBJ/aGJGiqrqF6YvlSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204053; 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=QtyKhiFbkbsqM4ULIeNdMsbLLGl+jPQ/adgmG2FXdK0=; b=nwuC97gjQMjJi5Te2S9VOFOJtmn26X0ItkmAawoUmfCKeN4gOUY4FXI9Co8ynOL3nYEWIkSVHzf8URjguqNfRwi3V+qIEzFFMaUflPnuA/uuona4COcZH1z77fDRZsVgw5BzcEVT7eztJAaTa7+xHfN+cfT5EkbEGTepUvKPHns= 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+76783+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 1624204053337396.41430499524824; Sun, 20 Jun 2021 08:47:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OzgDYY1788612xlJ0PvktKlK; Sun, 20 Jun 2021 08:47:33 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:27 -0700 IronPort-SDR: x/I30cySNHRE9vEh10K5M7MloF3UheRcVrSTwcoYlRP7d5YyCeXJg46ltOZ0qol/E+1phjfHqT 4NhY+Z+DHHAA== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044441" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044441" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:27 -0700 IronPort-SDR: CvSe2mA8Q2fc9NrBXk6bdYp++OQHoebmWWXZ0Uc7LUBwADnFAFLJArepmQ38UageQC/dB1Plny f8TDxC4jTHvg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932667" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:26 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 08/12] UefiPayloadPkg: Include UniversalPayLoad modules in UefiPayloadPkg.dsc Date: Sun, 20 Jun 2021 23:46:58 +0800 Message-Id: <20210620154702.2681-9-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: KkSr2GbXN0hbznbeREogwjDAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204053; bh=2dUduSsVX85wPSM2H01BvU0pq8L2nUy0HOVAPuuTv+U=; h=Cc:Date:From:Reply-To:Subject:To; b=cF3ooaFTrP67ypdKQ/fp5DTdjKMGrDKM94Ot+14vzLrffEZABuebF30FXnEXQUbXP0q TMgaO/goaqZoGsfhv4lO546q7zZXg8Kd6BH+mT4iFElZsk6aj40IFgAIkOHdS6kbuOlKo 2SQwFTx2KCTvGeDPhespBOjtgYnMozMKGKM= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- 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.16.2.windows.1 -=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 (#76783): https://edk2.groups.io/g/devel/message/76783 Mute This Topic: https://groups.io/mt/83669562/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 05:04:50 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+76784+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+76784+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204054; cv=none; d=zohomail.com; s=zohoarc; b=XlR0s7f1NO253INNpI/thPUo3l8QfuiloYQ9MrPx+meA21o0WJOlnf4+PBjjINbKX5vlYLptllIkAcGPaciNZmEdPg1SrQSoKKPQh+cos6aVp33pWXwM7vfL7Y6+60Vky6f2AEVdjkezJ8U7N1VNYM+GEiBbgu40KO3nUEgeOqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204054; 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=8L9/d3riOcsfmsgd+DXNU+rko7LMH2fm83/An/ISw0w=; b=fZo5ExbVyfVp3ZskpZv59BF28LnG+GtglNq8bgib4AvPhuiTeOr1kNdr5cM4m0VVxlkelWJ6YzTrzSEu8herAVU3LpyG3Q7ns2RdqZC1KGEdVi5bvMWm2Xg1t8FPMfaMTGJFcriwqhfx4OE7qDQa3vcNhe8XX7PRtVu6Ruw5g54= 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+76784+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 1624204054942559.1292764261202; Sun, 20 Jun 2021 08:47:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id UsYkYY1788612xw8gBxwrSoQ; Sun, 20 Jun 2021 08:47:34 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:29 -0700 IronPort-SDR: pbc8LkjknTg8WUWvFdGL0xBT4+ifE8mjXI7i1xpL2QI+chatklLbp4k9KfZfcUReevsbUlJipQ e8bzniqmhx1Q== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044457" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044457" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:28 -0700 IronPort-SDR: BXJAEOYuJMbKejgxvWYo7UacibEmtaTIg1l7oBrLDHPQ3sY42DWD7mL+99apxavCKEVO+8rJwg aNwOv7RaEOmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932680" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:27 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 09/12] UefiPayloadPkg: Remove assert when reserve MMIO/IO resource for devices Date: Sun, 20 Jun 2021 23:46:59 +0800 Message-Id: <20210620154702.2681-10-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: N4IedbiEkhG2H1BRx1Hf2rv5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204054; bh=qGmrnhS1eqw8L5wNj2RCs77ZQOvK0nl6smPNG94lf2Y=; h=Cc:Date:From:Reply-To:Subject:To; b=KBJ7z2MfwitkamKYYFAxzBUQOYxLPdslVc8pz/2nQrFUs9WpiHl/4Qq9Nuzp6eAZAUE k/UAZBH4X3NruTgFz5vLe0LVPRMMQyz/KoQD80kMyT4Oc8N34ol9qWEP4uguIfjFJ1VrO zK9OiogWstRWsLmPq6pJlSfPPehsc5Ho/SI= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- 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.16.2.windows.1 -=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 (#76784): https://edk2.groups.io/g/devel/message/76784 Mute This Topic: https://groups.io/mt/83669563/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 05:04:50 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+76785+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+76785+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204056; cv=none; d=zohomail.com; s=zohoarc; b=lEZlGBHJU1oVyw/wJrjFvQFECWWjoLRKfiHNOrylJsFC3a/4VahgNhROn2xOtZa84iZA2rpjuL89ToUzJww1dsL4NcgkpoBcHvjtueZNNuvVc7kAkl/AETbSrTcPsvhS9TBaYA8LEeKTg/dMSgudYTVDxUKQWB7dab8ZSxd6v6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204056; 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=lG63Ah/mTCg7DAgS+DIirA2O2Th5P59tdHmY3b81KNM=; b=azbb7U8GmygoCKU0Ir3pv3Sv0bAkN4gyj9gvJJkrqV9zq+t3oZ1Cy4Ao8dENrUUO5cDgU+ze2YlhgfyUQANKqT5BSMzOaTtBxjV2iH9y8YuAa6v1vobnnbhjjnDKZ775Rg9PhvqzFbp1sJV9OqfRmdWPRgyx5/aHIDeMvb3ZfiI= 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+76785+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 1624204056294959.3442347539751; Sun, 20 Jun 2021 08:47:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id eVMcYY1788612xII4WRFJgDO; Sun, 20 Jun 2021 08:47:35 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:30 -0700 IronPort-SDR: OphBD84wxiF5Lkhk01BKp8jCZ5UA4QR0cbEGyo9o4DSiDjWcwi9ru4O//N2CEkK+I4OtIaDHpI nOlXaadrqTZQ== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044465" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044465" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:30 -0700 IronPort-SDR: oCrk/AdUmuZxbS5DJOdUfp5P6dsq/7j77MNV/oazFKUjOjGRBI5EUWmQDjSwMNPzYOQgKqxaOO Vqm0/+WL3XvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932693" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:29 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 10/12] UefiPayloadPkg: Add macro to disable some drivers Date: Sun, 20 Jun 2021 23:47:00 +0800 Message-Id: <20210620154702.2681-11-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: 8D5DEJATkaMCkosrmNROTa0Hx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204055; bh=0dSLCf520ZkXQSN6v6APbk/iibTNNXbn6FMxRE2XY8M=; h=Cc:Date:From:Reply-To:Subject:To; b=sAbFA2jq0xMwHzK/Rtis8Vsdzx8oBgywv3K4qwCPtAn8B8tNG4TYSkidy8Vt4q2LqEW dAFpTOGqgvxVaRxBSnOojy2DKXkwAvmxDdTbf66efWHVnCqCR7zq8trzSvrHnmZqO/yEm gonWpBOVBswbWi9nJ9VM7RZsSc0EOLygWA8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Signed-off-by: Zhiguang Liu --- 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..99b0e49d46 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -87,6 +87,12 @@ # DEFINE SHELL_TYPE =3D BUILD_SHELL =20 + # + # Disable features + # + DEFINE DISABLE_VARIABLE =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 $(DISABLE_VARIABLE) =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..3b6adc2cfe 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 $(DISABLE_VARIABLE) =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.16.2.windows.1 -=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 (#76785): https://edk2.groups.io/g/devel/message/76785 Mute This Topic: https://groups.io/mt/83669565/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 05:04:50 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+76786+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+76786+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204053; cv=none; d=zohomail.com; s=zohoarc; b=DAeyf7pW3o2TitfL78WbpdbGvMEB5WkcwU1943ncxUrmaz9j5O7y+W9Pqq7EdGEwY+ZNHPV/3eUxbURTzIDC2YhgqqhBL2jH10bCjyAehhDI219p1BAqEC+5iJEb8ACeifCvGAjKPmvoKqrnrIjTPtDYIjSbw35Rw5fcHS5oHVE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204053; 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=qzwMDF22wNdnSlp44JRf2/NgHTNOvg0vLQvU2LL8DDE=; b=CoREbvs+mCVtzvGgwo9ACUCDweDVh+f/Xxix5HzDJgHxXvbU8OgOkmGbfjg4H57ewYQTURSqZfwJhHURm2zjGhAj2A6bKt/In+M2wHPzlgOIxEIKIBjxtEQksEnxg9pbRJaTp/Rsm6HDVnNRzELVbF/tCcT43wn154BsyJMUsh8= 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+76786+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 162420405329720.197585767497912; Sun, 20 Jun 2021 08:47:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 81BRYY1788612xlnRFqpXUjJ; Sun, 20 Jun 2021 08:47:32 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:32 -0700 IronPort-SDR: xgOZ2OI8YM/eAVe+Ovcb6uuiRPlr513Ko6DartsenfYONnAmSnadLNCklzAOFth6a4c3EJqQ1W kaKAJG9NCv+Q== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044478" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044478" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:31 -0700 IronPort-SDR: R9PhUxy8gg3AsddX/oe+/uncXLNvxZjq+dbNDxwrUrbV0AwHy8MtMCuRlwZ1VEAO06PuAbyF+Z fr91c6gct/9g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932712" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:30 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 11/12] UefiPayloadPkg: Add PcdInstallAcpiSdtProtocol feature in UefiPayloadPkg Date: Sun, 20 Jun 2021 23:47:01 +0800 Message-Id: <20210620154702.2681-12-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: vF2qIFKkDiJFZGwgoQGAyerDx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204052; bh=UUjOISS14Od/MgH55+j04AKOfetMVvMDPMKhqb8crUs=; h=Cc:Date:From:Reply-To:Subject:To; b=wKO/hdPvSe2jD/05WM5S+Yx7dWiKLduMtnqucpwDXECjRrgZQHqE4HKZ6Fyzt3nj+iO Y1NmT7acunoasv7x5zToo4e/XoWCry8KzLSyYeLk/6nosA8TtTGflsLc0R/UwDcQ6o8hf L1y6FMB1aKJttdRH5NU9gG1ljSEjgrtkqtc= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 99b0e49d46..930831d30c 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.16.2.windows.1 -=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 (#76786): https://edk2.groups.io/g/devel/message/76786 Mute This Topic: https://groups.io/mt/83669566/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 05:04:50 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+76787+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+76787+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1624204054; cv=none; d=zohomail.com; s=zohoarc; b=jik8Mk9Sxo2suq4Cqmypr16VETZnXWrvOnQgl4rXjYJdUylZncw2Nx2yl2rYtyfGvjJ/0ti/V4Nd4K9ZXPdbFdiTXrriepRsh+F0c+jGuGDIAMfDg52SyEJsg9SCpIuVLEGmHKal1iUERiqYVFZcr5Z98uPpIwE8DIC6WBrEBh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624204054; 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=PPy4tVKUiDeaMYo6K6YgYPBR28Y2Md6Tkz2XQqfXwDM=; b=Mrz/uLI5EkO8utCUEvmvfQclvL9GarWwhra00BHVSaG51oarjR532e2AjxHEjNRO++ZNvX61nS3spBUtSkYSilYy8hW90zyzNxQkriI8WfvBY2w0qH6xs9RMCUYgg5Z0z0kdEl8Xr1gaNM6IRDRNif9qe6Dokd+sK5BF5AGDBBs= 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+76787+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 1624204054525769.2066208187123; Sun, 20 Jun 2021 08:47:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id H4ZwYY1788612xSlrpxtWreu; Sun, 20 Jun 2021 08:47:34 -0700 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web08.34931.1624204037148521455 for ; Sun, 20 Jun 2021 08:47:33 -0700 IronPort-SDR: VuSCLRilOIK608tGw7KSaCm7mh8RvdiHDFiPvuCxVAUlVAJ7vhv0xaQGe1RoDh0IgD3MFXP7A/ wNDBXHZw7uZw== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194044488" X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="194044488" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2021 08:47:33 -0700 IronPort-SDR: 7yOBa2BS1N38tCx/H5PO0zFS67xBT6tSAOwHPqoqJzlRQs7wUiU87OaxfWvsANOOlNE2PQ2cDg e/lsmt/D0oEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,287,1616482800"; d="scan'208";a="451932748" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga008.jf.intel.com with ESMTP; 20 Jun 2021 08:47:31 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 12/12] UefiPayloadPkg: Add PcdResetOnMemoryTypeInformationChange in UefiPayloadPkg Date: Sun, 20 Jun 2021 23:47:02 +0800 Message-Id: <20210620154702.2681-13-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-1-zhiguang.liu@intel.com> References: <20210620154702.2681-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: teloqrbG0lq65yXMTUE0IVDKx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624204054; bh=Dj/l2YSaAs20whZOq27gftTN0HTLKCNuYs19X66kVmM=; h=Cc:Date:From:Reply-To:Subject:To; b=fyhfybhK9+pZTUdoP1K2T2FJteB7uULqvcwJ7HE2NnpWAVwwHxplnO1OE9V6eAZ+jIF HgayBtSpqYB+SN79fMalED7gANsv8wPkd8g1ie0VkO5Wko1Yv3HYy8fM1BDH3CnplVQkW pFwQ6sOtVPlwxwYGnY3Fy+qWenKAE/yUclc= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- UefiPayloadPkg/UefiPayloadPkg.dsc | 1 + 1 file changed, 1 insertion(+) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 930831d30c..f1bf80bc6d 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.16.2.windows.1 -=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 (#76787): https://edk2.groups.io/g/devel/message/76787 Mute This Topic: https://groups.io/mt/83669568/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-