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>
This commit is contained in:
@@ -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 $
|
||||
|
@@ -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)) {
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -92,7 +92,6 @@
|
||||
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
|
||||
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
|
||||
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
|
||||
|
@@ -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 $
|
||||
|
Reference in New Issue
Block a user