From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web10.5097.1632894555277313263 for ; Tue, 28 Sep 2021 22:49:15 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: guo.dong@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10121"; a="285880825" X-IronPort-AV: E=Sophos;i="5.85,331,1624345200"; d="scan'208";a="285880825" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 22:49:14 -0700 X-IronPort-AV: E=Sophos;i="5.85,331,1624345200"; d="scan'208";a="617279547" Received: from gdong1-mobl1.amr.corp.intel.com ([10.212.91.91]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 22:49:13 -0700 From: "Guo Dong" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You Subject: [`edk2-devel][PATCH] UefiPayloadPkg: Remove asm code and sharing libraries Date: Tue, 28 Sep 2021 22:49:03 -0700 Message-Id: <20210929054903.1188-1-guo.dong@intel.com> X-Mailer: git-send-email 2.32.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Guo Dong Remove asm code used for payload entry. Use patchable PCD instead a fixed PCD PcdPayloadStackTop to avoid potential conflict. Based on the removal, use same HobLib regardless UNIVERSAL_PAYLOAD. Use same PlatformHookLib regardless UNIVERSAL_PAYLOAD. The original PlatformHookLib was removed and UniversalPayloadPlatformHookLib was rename to new PlatformHookLib. Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Signed-off-by: Guo Dong --- UefiPayloadPkg/Include/Library/BlParseLib.h = | 5 ++--- UefiPayloadPkg/Library/CbParseLib/CbParseLib.c = | 6 ++++-- UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf = | 4 ++-- UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c = | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------= ------------------------------------------ UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf = | 18 ++++++++++-------- UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf = | 4 ++-- UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c = | 95 --------------------------------------------------------------------= --------------------------- UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf= | 40 ---------------------------------------- UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm = | 46 ---------------------------------------------- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c = | 30 +++++++++++++++++++++++------- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h = | 1 + UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf = | 5 ++--- UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf = | 1 - UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm = | 47 ----------------------------------------------- UefiPayloadPkg/UefiPayloadPkg.dec = | 4 ++-- UefiPayloadPkg/UefiPayloadPkg.dsc = | 10 +--------- 16 files changed, 105 insertions(+), 321 deletions(-) diff --git a/UefiPayloadPkg/Include/Library/BlParseLib.h b/UefiPayloadPkg/I= nclude/Library/BlParseLib.h index 20a526d15c..1244190d4e 100644 --- a/UefiPayloadPkg/Include/Library/BlParseLib.h +++ b/UefiPayloadPkg/Include/Library/BlParseLib.h @@ -2,7 +2,7 @@ This library will parse the coreboot table in memory and extract those r= equired=0D information.=0D =0D - Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -16,8 +16,7 @@ #ifndef __BOOTLOADER_PARSE_LIB__=0D #define __BOOTLOADER_PARSE_LIB__=0D =0D -#define GET_BOOTLOADER_PARAMETER() (*(UINTN *)(UINTN)(PcdGet32(PcdPay= loadStackTop) - sizeof(UINT64)))=0D -#define SET_BOOTLOADER_PARAMETER(Value) GET_BOOTLOADER_PARAMETER()=3DValue= =0D +#define GET_BOOTLOADER_PARAMETER() PcdGet64 (PcdBootloaderParameter)= =0D =0D typedef RETURN_STATUS \=0D (*BL_MEM_INFO_CALLBACK) (MEMROY_MAP_ENTRY *MemoryMapEntry, VOID *P= aram);=0D diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c b/UefiPayloadPk= g/Library/CbParseLib/CbParseLib.c index 4e23cff50e..4f90687e40 100644 --- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c +++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c @@ -2,7 +2,7 @@ This library will parse the coreboot table in memory and extract those r= equired=0D information.=0D =0D - Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -140,6 +140,7 @@ GetParameterBase ( UINT8 *TmpPtr;=0D UINT8 *CbTablePtr;=0D UINTN Idx;=0D + EFI_STATUS Status;=0D =0D //=0D // coreboot could pass coreboot table to UEFI payload=0D @@ -193,7 +194,8 @@ GetParameterBase ( return NULL;=0D }=0D =0D - SET_BOOTLOADER_PARAMETER ((UINT32)(UINTN)CbTablePtr);=0D + PcdSet64S (PcdBootloaderParameter, (UINTN)CbTablePtr);=0D + ASSERT_EFI_STATUS (Status);=0D =0D return CbTablePtr;=0D }=0D diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf b/UefiPayload= Pkg/Library/CbParseLib/CbParseLib.inf index 52e3ad2054..cf81697703 100644 --- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf +++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf @@ -1,7 +1,7 @@ ## @file=0D # Coreboot Table Parse Library.=0D #=0D -# Copyright (c) 2014, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
= =0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D ##=0D @@ -36,4 +36,4 @@ PcdLib=0D =0D [Pcd]=0D - gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop=0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter=0D diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c b/Uef= iPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c index d8453e5957..004fcd8b7c 100644 --- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c +++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c @@ -1,29 +1,34 @@ /** @file=0D Platform Hook Library instance for UART device.=0D =0D - Copyright (c) 2015, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D =0D #include =0D -#include =0D -#include =0D +#include =0D +#include =0D #include =0D -#include =0D #include =0D +#include =0D =0D -typedef struct {=0D - UINT16 VendorId; ///< Vendor ID to match the PCI device. The = value 0xFFFF terminates the list of entries.=0D - UINT16 DeviceId; ///< Device ID to match the PCI device=0D - UINT32 ClockRate; ///< UART clock rate. Set to 0 for default c= lock rate of 1843200 Hz=0D - UINT64 Offset; ///< The byte offset into to the BAR=0D - UINT8 BarIndex; ///< Which BAR to get the UART base address=0D - UINT8 RegisterStride; ///< UART register stride in bytes. Set to 0= for default register stride of 1 byte.=0D - UINT16 ReceiveFifoDepth; ///< UART receive FIFO depth in bytes. Set to= 0 for a default FIFO depth of 16 bytes.=0D - UINT16 TransmitFifoDepth; ///< UART transmit FIFO depth in bytes. Set t= o 0 for a default FIFO depth of 16 bytes.=0D - UINT8 Reserved[2];=0D -} PCI_SERIAL_PARAMETER;=0D +=0D +/** Library Constructor=0D +=0D + @retval RETURN_SUCCESS Success.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +PlatformHookSerialPortConstructor (=0D + VOID=0D + )=0D +{=0D + // Nothing to do here. This constructor is added to=0D + // enable the chain of constructor invocation for=0D + // dependent libraries.=0D + return RETURN_SUCCESS;=0D +}=0D =0D /**=0D Performs platform specific initialization required for the CPU to access= =0D @@ -42,52 +47,49 @@ PlatformHookSerialPortInitialize ( VOID=0D )=0D {=0D - RETURN_STATUS Status;=0D - UINT32 DeviceVendor;=0D - PCI_SERIAL_PARAMETER *SerialParam;=0D - SERIAL_PORT_INFO SerialPortInfo;=0D -=0D - Status =3D ParseSerialInfo (&SerialPortInfo);=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D - }=0D + RETURN_STATUS Status;=0D + UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *SerialPortInfo;=0D + UINT8 *GuidHob;=0D + UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;=0D =0D - if (SerialPortInfo.Type =3D=3D PLD_SERIAL_TYPE_MEMORY_MAPPED) {=0D - Status =3D PcdSetBoolS (PcdSerialUseMmio, TRUE);=0D - } else { //IO=0D - Status =3D PcdSetBoolS (PcdSerialUseMmio, FALSE);=0D - }=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D - }=0D - Status =3D PcdSet64S (PcdSerialRegisterBase, SerialPortInfo.BaseAddr);=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D + GuidHob =3D GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid);=0D + if (GuidHob =3D=3D NULL) {=0D + return EFI_NOT_FOUND;=0D }=0D =0D - Status =3D PcdSet32S (PcdSerialRegisterStride, SerialPortInfo.RegWidth);= =0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D + GenericHeader =3D (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA= (GuidHob);=0D + if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE = (GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {= =0D + return EFI_NOT_FOUND;=0D }=0D =0D - Status =3D PcdSet32S (PcdSerialBaudRate, SerialPortInfo.Baud);=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D - }=0D + if (GenericHeader->Revision =3D=3D UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_RE= VISION) {=0D + SerialPortInfo =3D (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *) GET_GUID_HOB= _DATA (GuidHob);=0D + if (GenericHeader->Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UN= IVERSAL_PAYLOAD_SERIAL_PORT_INFO, RegisterBase)) {=0D + //=0D + // Return if can't find the Serial Port Info Hob with enough length= =0D + //=0D + return EFI_NOT_FOUND;=0D + }=0D =0D - Status =3D PcdSet32S (PcdSerialClockRate, SerialPortInfo.InputHertz);=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D - }=0D + Status =3D PcdSetBoolS (PcdSerialUseMmio, SerialPortInfo->UseMmio);=0D + if (RETURN_ERROR (Status)) {=0D + return Status;=0D + }=0D + Status =3D PcdSet64S (PcdSerialRegisterBase, SerialPortInfo->RegisterB= ase);=0D + if (RETURN_ERROR (Status)) {=0D + return Status;=0D + }=0D + Status =3D PcdSet32S (PcdSerialRegisterStride, SerialPortInfo->Registe= rStride);=0D + if (RETURN_ERROR (Status)) {=0D + return Status;=0D + }=0D + Status =3D PcdSet32S (PcdSerialBaudRate, SerialPortInfo->BaudRate);=0D + if (RETURN_ERROR (Status)) {=0D + return Status;=0D + }=0D =0D - if (SerialPortInfo.UartPciAddr >=3D 0x80000000) {=0D - DeviceVendor =3D PciRead32 (SerialPortInfo.UartPciAddr & 0x0ffff000);= =0D - SerialParam =3D PcdGetPtr(PcdPciSerialParameters);=0D - SerialParam->VendorId =3D (UINT16)DeviceVendor;=0D - SerialParam->DeviceId =3D DeviceVendor >> 16;=0D - SerialParam->ClockRate =3D SerialPortInfo.InputHertz;=0D - SerialParam->RegisterStride =3D (UINT8)SerialPortInfo.RegWidth;=0D + return RETURN_SUCCESS;=0D }=0D =0D - return RETURN_SUCCESS;=0D + return EFI_NOT_FOUND;=0D }=0D diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf b/U= efiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf index 3eeb94d8fa..7ac6bfa1b1 100644 --- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf +++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf @@ -1,7 +1,7 @@ ## @file=0D -# Platform Hook Library instance for UART device.=0D +# Platform Hook Library instance for UART device for Universal Payload.=0D #=0D -# Copyright (c) 2015, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -10,29 +10,31 @@ [Defines]=0D INF_VERSION =3D 0x00010005=0D BASE_NAME =3D PlatformHookLib=0D - FILE_GUID =3D 40A2CBC6-CFB8-447b-A90E-198E88FD345E= =0D + FILE_GUID =3D 807E05AB-9411-429F-97F0-FE425BF6B094= =0D MODULE_TYPE =3D BASE=0D VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D PlatformHookLib=0D - CONSTRUCTOR =3D PlatformHookSerialPortInitialize=0D + CONSTRUCTOR =3D PlatformHookSerialPortConstructor=0D =0D [Sources]=0D PlatformHookLib.c=0D =0D [LibraryClasses]=0D - BlParseLib=0D PcdLib=0D - PciLib=0D + BaseLib=0D + HobLib=0D + DxeHobListLib=0D =0D [Packages]=0D MdePkg/MdePkg.dec=0D MdeModulePkg/MdeModulePkg.dec=0D UefiPayloadPkg/UefiPayloadPkg.dec=0D =0D +[Guids]=0D + gUniversalPayloadSerialPortInfoGuid=0D +=0D [Pcd]=0D gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## PRODUCES=0D gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES=0D gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES=0D gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## PRODUCES=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdPciSerialParameters ## PRODUCES=0D diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf b/UefiPaylo= adPkg/Library/SblParseLib/SblParseLib.inf index 9ce2864f9f..665a5a8adc 100644 --- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf +++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf @@ -1,7 +1,7 @@ ## @file=0D # Slim Bootloader parse library.=0D #=0D -# Copyright (c) 2019, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
= =0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D ##=0D @@ -43,4 +43,4 @@ gEfiGraphicsDeviceInfoHobGuid=0D =0D [Pcd]=0D - gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop=0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter=0D diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor= mHookLib.c b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor= mHookLib.c deleted file mode 100644 index 004fcd8b7c..0000000000 --- a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLi= b.c +++ /dev/null @@ -1,95 +0,0 @@ -/** @file=0D - Platform Hook Library instance for UART device.=0D -=0D - Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D - SPDX-License-Identifier: BSD-2-Clause-Patent=0D -=0D -**/=0D -=0D -#include =0D -#include =0D -#include =0D -#include =0D -#include =0D -#include =0D -=0D -=0D -/** Library Constructor=0D -=0D - @retval RETURN_SUCCESS Success.=0D -**/=0D -EFI_STATUS=0D -EFIAPI=0D -PlatformHookSerialPortConstructor (=0D - VOID=0D - )=0D -{=0D - // Nothing to do here. This constructor is added to=0D - // enable the chain of constructor invocation for=0D - // dependent libraries.=0D - return RETURN_SUCCESS;=0D -}=0D -=0D -/**=0D - Performs platform specific initialization required for the CPU to access= =0D - the hardware associated with a SerialPortLib instance. This function do= es=0D - not initialize the serial port hardware itself. Instead, it initializes= =0D - hardware devices that are required for the CPU to access the serial port= =0D - hardware. This function may be called more than once.=0D -=0D - @retval RETURN_SUCCESS The platform specific initialization succee= ded.=0D - @retval RETURN_DEVICE_ERROR The platform specific initialization could = not be completed.=0D -=0D -**/=0D -RETURN_STATUS=0D -EFIAPI=0D -PlatformHookSerialPortInitialize (=0D - VOID=0D - )=0D -{=0D - RETURN_STATUS Status;=0D - UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *SerialPortInfo;=0D - UINT8 *GuidHob;=0D - UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;=0D -=0D - GuidHob =3D GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid);=0D - if (GuidHob =3D=3D NULL) {=0D - return EFI_NOT_FOUND;=0D - }=0D -=0D - GenericHeader =3D (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA= (GuidHob);=0D - if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE = (GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {= =0D - return EFI_NOT_FOUND;=0D - }=0D -=0D - if (GenericHeader->Revision =3D=3D UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_RE= VISION) {=0D - SerialPortInfo =3D (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *) GET_GUID_HOB= _DATA (GuidHob);=0D - if (GenericHeader->Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UN= IVERSAL_PAYLOAD_SERIAL_PORT_INFO, RegisterBase)) {=0D - //=0D - // Return if can't find the Serial Port Info Hob with enough length= =0D - //=0D - return EFI_NOT_FOUND;=0D - }=0D -=0D - Status =3D PcdSetBoolS (PcdSerialUseMmio, SerialPortInfo->UseMmio);=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D - }=0D - Status =3D PcdSet64S (PcdSerialRegisterBase, SerialPortInfo->RegisterB= ase);=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D - }=0D - Status =3D PcdSet32S (PcdSerialRegisterStride, SerialPortInfo->Registe= rStride);=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D - }=0D - Status =3D PcdSet32S (PcdSerialBaudRate, SerialPortInfo->BaudRate);=0D - if (RETURN_ERROR (Status)) {=0D - return Status;=0D - }=0D -=0D - return RETURN_SUCCESS;=0D - }=0D -=0D - return EFI_NOT_FOUND;=0D -}=0D diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor= mHookLib.inf b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platf= ormHookLib.inf deleted file mode 100644 index 7ac6bfa1b1..0000000000 --- a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLi= b.inf +++ /dev/null @@ -1,40 +0,0 @@ -## @file=0D -# Platform Hook Library instance for UART device for Universal Payload.=0D -#=0D -# Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D -#=0D -# SPDX-License-Identifier: BSD-2-Clause-Patent=0D -#=0D -##=0D -=0D -[Defines]=0D - INF_VERSION =3D 0x00010005=0D - BASE_NAME =3D PlatformHookLib=0D - FILE_GUID =3D 807E05AB-9411-429F-97F0-FE425BF6B094= =0D - MODULE_TYPE =3D BASE=0D - VERSION_STRING =3D 1.0=0D - LIBRARY_CLASS =3D PlatformHookLib=0D - CONSTRUCTOR =3D PlatformHookSerialPortConstructor=0D -=0D -[Sources]=0D - PlatformHookLib.c=0D -=0D -[LibraryClasses]=0D - PcdLib=0D - BaseLib=0D - HobLib=0D - DxeHobListLib=0D -=0D -[Packages]=0D - MdePkg/MdePkg.dec=0D - MdeModulePkg/MdeModulePkg.dec=0D - UefiPayloadPkg/UefiPayloadPkg.dec=0D -=0D -[Guids]=0D - gUniversalPayloadSerialPortInfoGuid=0D -=0D -[Pcd]=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## PRODUCES=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm b/UefiPaylo= adPkg/UefiPayloadEntry/Ia32/SecEntry.nasm deleted file mode 100644 index fa5ed159c6..0000000000 --- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;-------------------------------------------------------------------------= -----=0D -;*=0D -;* Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.=0D -;* SPDX-License-Identifier: BSD-2-Clause-Patent=0D -=0D -;-------------------------------------------------------------------------= -----=0D -=0D -#include =0D -=0D -SECTION .text=0D -=0D -extern ASM_PFX(PayloadEntry)=0D -extern ASM_PFX(PcdGet32 (PcdPayloadStackTop))=0D -=0D -;=0D -; SecCore Entry Point=0D -;=0D -; Processor is in flat protected mode=0D -=0D -global ASM_PFX(_ModuleEntryPoint)=0D -ASM_PFX(_ModuleEntryPoint):=0D -=0D - ;=0D - ; Disable all the interrupts=0D - ;=0D - cli=0D -=0D - ;=0D - ; Save the bootloader parameter base address=0D - ;=0D - mov eax, [esp + 4]=0D -=0D - mov esp, FixedPcdGet32 (PcdPayloadStackTop)=0D -=0D - ;=0D - ; Push the bootloader parameter address onto new stack=0D - ;=0D - push 0=0D - push eax=0D -=0D - ;=0D - ; Call into C code=0D - ;=0D - call ASM_PFX(PayloadEntry)=0D - jmp $=0D -=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.c index a12d9961f1..f2ac3d2c69 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -385,7 +385,7 @@ BuildGenericHob ( **/=0D EFI_STATUS=0D EFIAPI=0D -PayloadEntry (=0D +_ModuleEntryPoint (=0D IN UINTN BootloaderParameter=0D )=0D {=0D @@ -395,13 +395,10 @@ PayloadEntry ( UINTN HobMemBase;=0D UINTN HobMemTop;=0D EFI_PEI_HOB_POINTERS Hob;=0D + SERIAL_PORT_INFO SerialPortInfo;=0D + UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *UniversalSerialPort;=0D =0D - // Call constructor for all libraries=0D - ProcessLibraryConstructorList ();=0D -=0D - DEBUG ((DEBUG_INFO, "GET_BOOTLOADER_PARAMETER() =3D 0x%lx\n", GET_BOOTLO= ADER_PARAMETER()));=0D - DEBUG ((DEBUG_INFO, "sizeof(UINTN) =3D 0x%x\n", sizeof(UINTN)));=0D -=0D + PcdSet64S (PcdBootloaderParameter, BootloaderParameter);=0D // Initialize floating point operating environment to be compliant with = UEFI spec.=0D InitializeFloatingPointUnits ();=0D =0D @@ -412,6 +409,25 @@ PayloadEntry ( =0D HobConstructor ((VOID *)MemBase, (VOID *)HobMemTop, (VOID *)HobMemBase, = (VOID *)HobMemTop);=0D =0D + //=0D + // Build serial port info=0D + //=0D + Status =3D ParseSerialInfo (&SerialPortInfo);=0D + if (!EFI_ERROR (Status)) {=0D + UniversalSerialPort =3D BuildGuidHob (&gUniversalPayloadSerialPortInfo= Guid, sizeof (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO));=0D + ASSERT (UniversalSerialPort !=3D NULL);=0D + UniversalSerialPort->Header.Revision =3D UNIVERSAL_PAYLOAD_SERIAL_PORT= _INFO_REVISION;=0D + UniversalSerialPort->Header.Length =3D sizeof (UNIVERSAL_PAYLOAD_SER= IAL_PORT_INFO);=0D + UniversalSerialPort->UseMmio =3D (SerialPortInfo.Type =3D=3D 1= )?FALSE:TRUE;=0D + UniversalSerialPort->RegisterBase =3D SerialPortInfo.BaseAddr;=0D + UniversalSerialPort->BaudRate =3D SerialPortInfo.Baud;=0D + UniversalSerialPort->RegisterStride =3D (UINT8)SerialPortInfo.RegWidt= h;=0D + }=0D +=0D + // The library constructors might depend on serial port, so call it afte= r serial port hob=0D + ProcessLibraryConstructorList ();=0D + DEBUG ((DEBUG_INFO, "sizeof(UINTN) =3D 0x%x\n", sizeof(UINTN)));=0D +=0D // Build HOB based on information from Bootloader=0D Status =3D BuildHobFromBl ();=0D if (EFI_ERROR (Status)) {=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.h index 9922b56b39..de51c2fba9 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -35,6 +35,7 @@ #include =0D #include =0D #include =0D +#include =0D #include =0D =0D #define LEGACY_8259_MASK_REGISTER_MASTER 0x21=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPay= loadPkg/UefiPayloadEntry/UefiPayloadEntry.inf index 4c5170d9cc..96e4bb81f4 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf @@ -32,13 +32,11 @@ X64/VirtualMemory.c=0D Ia32/DxeLoadFunc.c=0D Ia32/IdtVectorAsm.nasm=0D - Ia32/SecEntry.nasm=0D =0D [Sources.X64]=0D X64/VirtualMemory.h=0D X64/VirtualMemory.c=0D X64/DxeLoadFunc.c=0D - X64/SecEntry.nasm=0D =0D [Packages]=0D MdePkg/MdePkg.dec=0D @@ -67,6 +65,7 @@ gUefiAcpiBoardInfoGuid=0D gUniversalPayloadSmbiosTableGuid=0D gUniversalPayloadAcpiTableGuid=0D + gUniversalPayloadSerialPortInfoGuid=0D =0D [FeaturePcd.IA32]=0D gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUME= S=0D @@ -87,7 +86,7 @@ =0D gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase=0D gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize=0D - gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop=0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter=0D gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize=0D =0D gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIM= ES_CONSUMES=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/Ue= fiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf index e7e05b744a..928bd2e42b 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf @@ -92,7 +92,6 @@ =0D gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase=0D gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize=0D - gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop=0D gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize=0D =0D gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIM= ES_CONSUMES=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm b/UefiPayloa= dPkg/UefiPayloadEntry/X64/SecEntry.nasm deleted file mode 100644 index 974cf77771..0000000000 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm +++ /dev/null @@ -1,47 +0,0 @@ -;-------------------------------------------------------------------------= -----=0D -;*=0D -;* Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.=0D -;* SPDX-License-Identifier: BSD-2-Clause-Patent=0D -=0D -;-------------------------------------------------------------------------= -----=0D -=0D -#include =0D -=0D -DEFAULT REL=0D -SECTION .text=0D -=0D -extern ASM_PFX(PayloadEntry)=0D -extern ASM_PFX(PcdGet32 (PcdPayloadStackTop))=0D -=0D -;=0D -; SecCore Entry Point=0D -;=0D -; Processor is in flat protected mode=0D -=0D -global ASM_PFX(_ModuleEntryPoint)=0D -ASM_PFX(_ModuleEntryPoint):=0D -=0D - ;=0D - ; Disable all the interrupts=0D - ;=0D - cli=0D -=0D -=0D - mov rsp, FixedPcdGet32 (PcdPayloadStackTop)=0D -=0D - ;=0D - ; Push the bootloader parameter address onto new stack=0D - ;=0D - push rcx=0D - mov rax, 0=0D - push rax ; shadow space=0D - push rax=0D - push rax=0D - push rax=0D -=0D - ;=0D - ; Call into C code=0D - ;=0D - call ASM_PFX(PayloadEntry)=0D - jmp $=0D -=0D diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayload= Pkg.dec index 8f0a7e3f95..e5e8db8863 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dec +++ b/UefiPayloadPkg/UefiPayloadPkg.dec @@ -60,8 +60,8 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase|0|UINT32|0x10000001=0D ## Provides the size of the payload binary in memory=0D gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize|0|UINT32|0x10000002=0D -## Payload stack top=0D -gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop|0x90000|UINT32|0x10000004= =0D +## Save bootloader parameter=0D +gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter|0|UINT64|0x10000004=0D =0D ## FFS filename to find the shell application.=0D gUefiPayloadPkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E,= 0x9E, 0x1c, 0x4f, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }|VOID*|0= x10000005=0D diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index fb805dc772..57b04f10be 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -169,12 +169,7 @@ IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf=0D OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf=0D RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf=0D -=0D -!if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE=0D HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf=0D -!else=0D - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D -!endif=0D =0D #=0D # UEFI & PI=0D @@ -217,11 +212,7 @@ TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf=0D ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf= =0D SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort= Lib16550.inf=0D -!if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE=0D - PlatformHookLib|UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/P= latformHookLib.inf=0D -!else=0D PlatformHookLib|UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.i= nf=0D -!endif=0D PlatformBootManagerLib|UefiPayloadPkg/Library/PlatformBootManagerLib/Pla= tformBootManagerLib.inf=0D IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf=0D =0D @@ -366,6 +357,7 @@ =0D gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|$(MAX_LOGICAL_= PROCESSORS)=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs|0=0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter|0=0D =0D ##########################################################################= ######=0D #=0D --=20 2.32.0.windows.2