diff options
author | Guo Dong <guo.dong@intel.com> | 2021-09-28 20:34:40 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-09-30 16:26:14 +0000 |
commit | 422e5d2f7f1abbecd9dd7baad54213251a8ed47f (patch) | |
tree | e2b97dae6156d26e6231b8907616e44730202952 /UefiPayloadPkg/UefiPayloadEntry | |
parent | 22737996771c8053189b8fe2839cf4a96272784a (diff) | |
download | edk2-422e5d2f7f1abbecd9dd7baad54213251a8ed47f.tar.gz edk2-422e5d2f7f1abbecd9dd7baad54213251a8ed47f.tar.bz2 edk2-422e5d2f7f1abbecd9dd7baad54213251a8ed47f.zip |
UefiPayloadPkg: Remove asm code and sharing libraries
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 <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'UefiPayloadPkg/UefiPayloadEntry')
6 files changed, 26 insertions, 104 deletions
diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm b/UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm deleted file mode 100644 index fa5ed159c6..0000000000 --- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------
-;*
-;* Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
-;* SPDX-License-Identifier: BSD-2-Clause-Patent
-
-;------------------------------------------------------------------------------
-
-#include <Base.h>
-
-SECTION .text
-
-extern ASM_PFX(PayloadEntry)
-extern ASM_PFX(PcdGet32 (PcdPayloadStackTop))
-
-;
-; SecCore Entry Point
-;
-; Processor is in flat protected mode
-
-global ASM_PFX(_ModuleEntryPoint)
-ASM_PFX(_ModuleEntryPoint):
-
- ;
- ; Disable all the interrupts
- ;
- cli
-
- ;
- ; Save the bootloader parameter base address
- ;
- mov eax, [esp + 4]
-
- mov esp, FixedPcdGet32 (PcdPayloadStackTop)
-
- ;
- ; Push the bootloader parameter address onto new stack
- ;
- push 0
- push eax
-
- ;
- ; Call into C code
- ;
- call ASM_PFX(PayloadEntry)
- jmp $
-
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c index a12d9961f1..f2ac3d2c69 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -385,7 +385,7 @@ BuildGenericHob ( **/
EFI_STATUS
EFIAPI
-PayloadEntry (
+_ModuleEntryPoint (
IN UINTN BootloaderParameter
)
{
@@ -395,13 +395,10 @@ PayloadEntry ( UINTN HobMemBase;
UINTN HobMemTop;
EFI_PEI_HOB_POINTERS Hob;
+ SERIAL_PORT_INFO SerialPortInfo;
+ UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *UniversalSerialPort;
- // Call constructor for all libraries
- ProcessLibraryConstructorList ();
-
- DEBUG ((DEBUG_INFO, "GET_BOOTLOADER_PARAMETER() = 0x%lx\n", GET_BOOTLOADER_PARAMETER()));
- DEBUG ((DEBUG_INFO, "sizeof(UINTN) = 0x%x\n", sizeof(UINTN)));
-
+ PcdSet64S (PcdBootloaderParameter, BootloaderParameter);
// Initialize floating point operating environment to be compliant with UEFI spec.
InitializeFloatingPointUnits ();
@@ -412,6 +409,25 @@ PayloadEntry ( HobConstructor ((VOID *)MemBase, (VOID *)HobMemTop, (VOID *)HobMemBase, (VOID *)HobMemTop);
+ //
+ // Build serial port info
+ //
+ Status = ParseSerialInfo (&SerialPortInfo);
+ if (!EFI_ERROR (Status)) {
+ UniversalSerialPort = BuildGuidHob (&gUniversalPayloadSerialPortInfoGuid, sizeof (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO));
+ ASSERT (UniversalSerialPort != NULL);
+ UniversalSerialPort->Header.Revision = UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_REVISION;
+ UniversalSerialPort->Header.Length = sizeof (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO);
+ UniversalSerialPort->UseMmio = (SerialPortInfo.Type == 1)?FALSE:TRUE;
+ UniversalSerialPort->RegisterBase = SerialPortInfo.BaseAddr;
+ UniversalSerialPort->BaudRate = SerialPortInfo.Baud;
+ UniversalSerialPort->RegisterStride = (UINT8)SerialPortInfo.RegWidth;
+ }
+
+ // The library constructors might depend on serial port, so call it after serial port hob
+ ProcessLibraryConstructorList ();
+ DEBUG ((DEBUG_INFO, "sizeof(UINTN) = 0x%x\n", sizeof(UINTN)));
+
// Build HOB based on information from Bootloader
Status = BuildHobFromBl ();
if (EFI_ERROR (Status)) {
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h index 9922b56b39..de51c2fba9 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -35,6 +35,7 @@ #include <UniversalPayload/AcpiTable.h>
#include <UniversalPayload/UniversalPayload.h>
#include <UniversalPayload/ExtraData.h>
+#include <UniversalPayload/SerialPortInfo.h>
#include <Guid/PcdDataBaseSignatureGuid.h>
#define LEGACY_8259_MASK_REGISTER_MASTER 0x21
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf index 4c5170d9cc..96e4bb81f4 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf @@ -32,13 +32,11 @@ X64/VirtualMemory.c
Ia32/DxeLoadFunc.c
Ia32/IdtVectorAsm.nasm
- Ia32/SecEntry.nasm
[Sources.X64]
X64/VirtualMemory.h
X64/VirtualMemory.c
X64/DxeLoadFunc.c
- X64/SecEntry.nasm
[Packages]
MdePkg/MdePkg.dec
@@ -67,6 +65,7 @@ gUefiAcpiBoardInfoGuid
gUniversalPayloadSmbiosTableGuid
gUniversalPayloadAcpiTableGuid
+ gUniversalPayloadSerialPortInfoGuid
[FeaturePcd.IA32]
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES
@@ -87,7 +86,7 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
- gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
+ gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf index e7e05b744a..928bd2e42b 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf @@ -92,7 +92,6 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
- gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm b/UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm deleted file mode 100644 index 974cf77771..0000000000 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm +++ /dev/null @@ -1,47 +0,0 @@ -;------------------------------------------------------------------------------
-;*
-;* Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
-;* SPDX-License-Identifier: BSD-2-Clause-Patent
-
-;------------------------------------------------------------------------------
-
-#include <Base.h>
-
-DEFAULT REL
-SECTION .text
-
-extern ASM_PFX(PayloadEntry)
-extern ASM_PFX(PcdGet32 (PcdPayloadStackTop))
-
-;
-; SecCore Entry Point
-;
-; Processor is in flat protected mode
-
-global ASM_PFX(_ModuleEntryPoint)
-ASM_PFX(_ModuleEntryPoint):
-
- ;
- ; Disable all the interrupts
- ;
- cli
-
-
- mov rsp, FixedPcdGet32 (PcdPayloadStackTop)
-
- ;
- ; Push the bootloader parameter address onto new stack
- ;
- push rcx
- mov rax, 0
- push rax ; shadow space
- push rax
- push rax
- push rax
-
- ;
- ; Call into C code
- ;
- call ASM_PFX(PayloadEntry)
- jmp $
-
|