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:
@ -2,7 +2,7 @@
|
|||||||
This library will parse the coreboot table in memory and extract those required
|
This library will parse the coreboot table in memory and extract those required
|
||||||
information.
|
information.
|
||||||
|
|
||||||
Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -16,8 +16,7 @@
|
|||||||
#ifndef __BOOTLOADER_PARSE_LIB__
|
#ifndef __BOOTLOADER_PARSE_LIB__
|
||||||
#define __BOOTLOADER_PARSE_LIB__
|
#define __BOOTLOADER_PARSE_LIB__
|
||||||
|
|
||||||
#define GET_BOOTLOADER_PARAMETER() (*(UINTN *)(UINTN)(PcdGet32(PcdPayloadStackTop) - sizeof(UINT64)))
|
#define GET_BOOTLOADER_PARAMETER() PcdGet64 (PcdBootloaderParameter)
|
||||||
#define SET_BOOTLOADER_PARAMETER(Value) GET_BOOTLOADER_PARAMETER()=Value
|
|
||||||
|
|
||||||
typedef RETURN_STATUS \
|
typedef RETURN_STATUS \
|
||||||
(*BL_MEM_INFO_CALLBACK) (MEMROY_MAP_ENTRY *MemoryMapEntry, VOID *Param);
|
(*BL_MEM_INFO_CALLBACK) (MEMROY_MAP_ENTRY *MemoryMapEntry, VOID *Param);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
This library will parse the coreboot table in memory and extract those required
|
This library will parse the coreboot table in memory and extract those required
|
||||||
information.
|
information.
|
||||||
|
|
||||||
Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -140,6 +140,7 @@ GetParameterBase (
|
|||||||
UINT8 *TmpPtr;
|
UINT8 *TmpPtr;
|
||||||
UINT8 *CbTablePtr;
|
UINT8 *CbTablePtr;
|
||||||
UINTN Idx;
|
UINTN Idx;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// coreboot could pass coreboot table to UEFI payload
|
// coreboot could pass coreboot table to UEFI payload
|
||||||
@ -193,7 +194,8 @@ GetParameterBase (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_BOOTLOADER_PARAMETER ((UINT32)(UINTN)CbTablePtr);
|
PcdSet64S (PcdBootloaderParameter, (UINTN)CbTablePtr);
|
||||||
|
ASSERT_EFI_STATUS (Status);
|
||||||
|
|
||||||
return CbTablePtr;
|
return CbTablePtr;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Coreboot Table Parse Library.
|
# Coreboot Table Parse Library.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
@ -36,4 +36,4 @@
|
|||||||
PcdLib
|
PcdLib
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
|
gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter
|
||||||
|
@ -1,29 +1,34 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Platform Hook Library instance for UART device.
|
Platform Hook Library instance for UART device.
|
||||||
|
|
||||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <Base.h>
|
#include <Base.h>
|
||||||
#include <Uefi/UefiBaseType.h>
|
#include <PiDxe.h>
|
||||||
#include <Library/PciLib.h>
|
#include <UniversalPayload/SerialPortInfo.h>
|
||||||
#include <Library/PlatformHookLib.h>
|
#include <Library/PlatformHookLib.h>
|
||||||
#include <Library/BlParseLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Library/HobLib.h>
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT16 VendorId; ///< Vendor ID to match the PCI device. The value 0xFFFF terminates the list of entries.
|
/** Library Constructor
|
||||||
UINT16 DeviceId; ///< Device ID to match the PCI device
|
|
||||||
UINT32 ClockRate; ///< UART clock rate. Set to 0 for default clock rate of 1843200 Hz
|
@retval RETURN_SUCCESS Success.
|
||||||
UINT64 Offset; ///< The byte offset into to the BAR
|
**/
|
||||||
UINT8 BarIndex; ///< Which BAR to get the UART base address
|
EFI_STATUS
|
||||||
UINT8 RegisterStride; ///< UART register stride in bytes. Set to 0 for default register stride of 1 byte.
|
EFIAPI
|
||||||
UINT16 ReceiveFifoDepth; ///< UART receive FIFO depth in bytes. Set to 0 for a default FIFO depth of 16 bytes.
|
PlatformHookSerialPortConstructor (
|
||||||
UINT16 TransmitFifoDepth; ///< UART transmit FIFO depth in bytes. Set to 0 for a default FIFO depth of 16 bytes.
|
VOID
|
||||||
UINT8 Reserved[2];
|
)
|
||||||
} PCI_SERIAL_PARAMETER;
|
{
|
||||||
|
// Nothing to do here. This constructor is added to
|
||||||
|
// enable the chain of constructor invocation for
|
||||||
|
// dependent libraries.
|
||||||
|
return RETURN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs platform specific initialization required for the CPU to access
|
Performs platform specific initialization required for the CPU to access
|
||||||
@ -42,52 +47,49 @@ PlatformHookSerialPortInitialize (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
RETURN_STATUS Status;
|
RETURN_STATUS Status;
|
||||||
UINT32 DeviceVendor;
|
UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *SerialPortInfo;
|
||||||
PCI_SERIAL_PARAMETER *SerialParam;
|
UINT8 *GuidHob;
|
||||||
SERIAL_PORT_INFO SerialPortInfo;
|
UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;
|
||||||
|
|
||||||
Status = ParseSerialInfo (&SerialPortInfo);
|
GuidHob = GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid);
|
||||||
if (RETURN_ERROR (Status)) {
|
if (GuidHob == NULL) {
|
||||||
return Status;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SerialPortInfo.Type == PLD_SERIAL_TYPE_MEMORY_MAPPED) {
|
GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA (GuidHob);
|
||||||
Status = PcdSetBoolS (PcdSerialUseMmio, TRUE);
|
if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE (GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {
|
||||||
} else { //IO
|
return EFI_NOT_FOUND;
|
||||||
Status = PcdSetBoolS (PcdSerialUseMmio, FALSE);
|
|
||||||
}
|
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
Status = PcdSet64S (PcdSerialRegisterBase, SerialPortInfo.BaseAddr);
|
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = PcdSet32S (PcdSerialRegisterStride, SerialPortInfo.RegWidth);
|
if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_REVISION) {
|
||||||
if (RETURN_ERROR (Status)) {
|
SerialPortInfo = (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *) GET_GUID_HOB_DATA (GuidHob);
|
||||||
return Status;
|
if (GenericHeader->Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO, RegisterBase)) {
|
||||||
|
//
|
||||||
|
// Return if can't find the Serial Port Info Hob with enough length
|
||||||
|
//
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = PcdSetBoolS (PcdSerialUseMmio, SerialPortInfo->UseMmio);
|
||||||
|
if (RETURN_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
Status = PcdSet64S (PcdSerialRegisterBase, SerialPortInfo->RegisterBase);
|
||||||
|
if (RETURN_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
Status = PcdSet32S (PcdSerialRegisterStride, SerialPortInfo->RegisterStride);
|
||||||
|
if (RETURN_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
Status = PcdSet32S (PcdSerialBaudRate, SerialPortInfo->BaudRate);
|
||||||
|
if (RETURN_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = PcdSet32S (PcdSerialBaudRate, SerialPortInfo.Baud);
|
return EFI_NOT_FOUND;
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = PcdSet32S (PcdSerialClockRate, SerialPortInfo.InputHertz);
|
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SerialPortInfo.UartPciAddr >= 0x80000000) {
|
|
||||||
DeviceVendor = PciRead32 (SerialPortInfo.UartPciAddr & 0x0ffff000);
|
|
||||||
SerialParam = PcdGetPtr(PcdPciSerialParameters);
|
|
||||||
SerialParam->VendorId = (UINT16)DeviceVendor;
|
|
||||||
SerialParam->DeviceId = DeviceVendor >> 16;
|
|
||||||
SerialParam->ClockRate = SerialPortInfo.InputHertz;
|
|
||||||
SerialParam->RegisterStride = (UINT8)SerialPortInfo.RegWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RETURN_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Platform Hook Library instance for UART device.
|
# Platform Hook Library instance for UART device for Universal Payload.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
@ -10,29 +10,31 @@
|
|||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 0x00010005
|
||||||
BASE_NAME = PlatformHookLib
|
BASE_NAME = PlatformHookLib
|
||||||
FILE_GUID = 40A2CBC6-CFB8-447b-A90E-198E88FD345E
|
FILE_GUID = 807E05AB-9411-429F-97F0-FE425BF6B094
|
||||||
MODULE_TYPE = BASE
|
MODULE_TYPE = BASE
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
LIBRARY_CLASS = PlatformHookLib
|
LIBRARY_CLASS = PlatformHookLib
|
||||||
CONSTRUCTOR = PlatformHookSerialPortInitialize
|
CONSTRUCTOR = PlatformHookSerialPortConstructor
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
PlatformHookLib.c
|
PlatformHookLib.c
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
BlParseLib
|
|
||||||
PcdLib
|
PcdLib
|
||||||
PciLib
|
BaseLib
|
||||||
|
HobLib
|
||||||
|
DxeHobListLib
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
UefiPayloadPkg/UefiPayloadPkg.dec
|
UefiPayloadPkg/UefiPayloadPkg.dec
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gUniversalPayloadSerialPortInfoGuid
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## PRODUCES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## PRODUCES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## PRODUCES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPciSerialParameters ## PRODUCES
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Slim Bootloader parse library.
|
# Slim Bootloader parse library.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
@ -43,4 +43,4 @@
|
|||||||
gEfiGraphicsDeviceInfoHobGuid
|
gEfiGraphicsDeviceInfoHobGuid
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
|
gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter
|
||||||
|
@ -1,95 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Platform Hook Library instance for UART device.
|
|
||||||
|
|
||||||
Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Base.h>
|
|
||||||
#include <PiDxe.h>
|
|
||||||
#include <UniversalPayload/SerialPortInfo.h>
|
|
||||||
#include <Library/PlatformHookLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
|
||||||
#include <Library/HobLib.h>
|
|
||||||
|
|
||||||
|
|
||||||
/** Library Constructor
|
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Success.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatformHookSerialPortConstructor (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Nothing to do here. This constructor is added to
|
|
||||||
// enable the chain of constructor invocation for
|
|
||||||
// dependent libraries.
|
|
||||||
return RETURN_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Performs platform specific initialization required for the CPU to access
|
|
||||||
the hardware associated with a SerialPortLib instance. This function does
|
|
||||||
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 succeeded.
|
|
||||||
@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 = GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid);
|
|
||||||
if (GuidHob == NULL) {
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
GenericHeader = (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 == UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_REVISION) {
|
|
||||||
SerialPortInfo = (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *) GET_GUID_HOB_DATA (GuidHob);
|
|
||||||
if (GenericHeader->Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO, RegisterBase)) {
|
|
||||||
//
|
|
||||||
// Return if can't find the Serial Port Info Hob with enough length
|
|
||||||
//
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = PcdSetBoolS (PcdSerialUseMmio, SerialPortInfo->UseMmio);
|
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
Status = PcdSet64S (PcdSerialRegisterBase, SerialPortInfo->RegisterBase);
|
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
Status = PcdSet32S (PcdSerialRegisterStride, SerialPortInfo->RegisterStride);
|
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
Status = PcdSet32S (PcdSerialBaudRate, SerialPortInfo->BaudRate);
|
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RETURN_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Platform Hook Library instance for UART device for Universal Payload.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x00010005
|
|
||||||
BASE_NAME = PlatformHookLib
|
|
||||||
FILE_GUID = 807E05AB-9411-429F-97F0-FE425BF6B094
|
|
||||||
MODULE_TYPE = BASE
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
LIBRARY_CLASS = PlatformHookLib
|
|
||||||
CONSTRUCTOR = PlatformHookSerialPortConstructor
|
|
||||||
|
|
||||||
[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
|
|
@ -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
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PayloadEntry (
|
_ModuleEntryPoint (
|
||||||
IN UINTN BootloaderParameter
|
IN UINTN BootloaderParameter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -395,13 +395,10 @@ PayloadEntry (
|
|||||||
UINTN HobMemBase;
|
UINTN HobMemBase;
|
||||||
UINTN HobMemTop;
|
UINTN HobMemTop;
|
||||||
EFI_PEI_HOB_POINTERS Hob;
|
EFI_PEI_HOB_POINTERS Hob;
|
||||||
|
SERIAL_PORT_INFO SerialPortInfo;
|
||||||
|
UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *UniversalSerialPort;
|
||||||
|
|
||||||
// Call constructor for all libraries
|
PcdSet64S (PcdBootloaderParameter, BootloaderParameter);
|
||||||
ProcessLibraryConstructorList ();
|
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "GET_BOOTLOADER_PARAMETER() = 0x%lx\n", GET_BOOTLOADER_PARAMETER()));
|
|
||||||
DEBUG ((DEBUG_INFO, "sizeof(UINTN) = 0x%x\n", sizeof(UINTN)));
|
|
||||||
|
|
||||||
// Initialize floating point operating environment to be compliant with UEFI spec.
|
// Initialize floating point operating environment to be compliant with UEFI spec.
|
||||||
InitializeFloatingPointUnits ();
|
InitializeFloatingPointUnits ();
|
||||||
|
|
||||||
@ -412,6 +409,25 @@ PayloadEntry (
|
|||||||
|
|
||||||
HobConstructor ((VOID *)MemBase, (VOID *)HobMemTop, (VOID *)HobMemBase, (VOID *)HobMemTop);
|
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
|
// Build HOB based on information from Bootloader
|
||||||
Status = BuildHobFromBl ();
|
Status = BuildHobFromBl ();
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <UniversalPayload/AcpiTable.h>
|
#include <UniversalPayload/AcpiTable.h>
|
||||||
#include <UniversalPayload/UniversalPayload.h>
|
#include <UniversalPayload/UniversalPayload.h>
|
||||||
#include <UniversalPayload/ExtraData.h>
|
#include <UniversalPayload/ExtraData.h>
|
||||||
|
#include <UniversalPayload/SerialPortInfo.h>
|
||||||
#include <Guid/PcdDataBaseSignatureGuid.h>
|
#include <Guid/PcdDataBaseSignatureGuid.h>
|
||||||
|
|
||||||
#define LEGACY_8259_MASK_REGISTER_MASTER 0x21
|
#define LEGACY_8259_MASK_REGISTER_MASTER 0x21
|
||||||
|
@ -32,13 +32,11 @@
|
|||||||
X64/VirtualMemory.c
|
X64/VirtualMemory.c
|
||||||
Ia32/DxeLoadFunc.c
|
Ia32/DxeLoadFunc.c
|
||||||
Ia32/IdtVectorAsm.nasm
|
Ia32/IdtVectorAsm.nasm
|
||||||
Ia32/SecEntry.nasm
|
|
||||||
|
|
||||||
[Sources.X64]
|
[Sources.X64]
|
||||||
X64/VirtualMemory.h
|
X64/VirtualMemory.h
|
||||||
X64/VirtualMemory.c
|
X64/VirtualMemory.c
|
||||||
X64/DxeLoadFunc.c
|
X64/DxeLoadFunc.c
|
||||||
X64/SecEntry.nasm
|
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
@ -67,6 +65,7 @@
|
|||||||
gUefiAcpiBoardInfoGuid
|
gUefiAcpiBoardInfoGuid
|
||||||
gUniversalPayloadSmbiosTableGuid
|
gUniversalPayloadSmbiosTableGuid
|
||||||
gUniversalPayloadAcpiTableGuid
|
gUniversalPayloadAcpiTableGuid
|
||||||
|
gUniversalPayloadSerialPortInfoGuid
|
||||||
|
|
||||||
[FeaturePcd.IA32]
|
[FeaturePcd.IA32]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES
|
||||||
@ -87,7 +86,7 @@
|
|||||||
|
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
|
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
|
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
|
gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
|
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
|
||||||
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
|
||||||
|
@ -92,7 +92,6 @@
|
|||||||
|
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
|
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
|
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop
|
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
|
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
|
||||||
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
|
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 $
|
|
||||||
|
|
@ -60,8 +60,8 @@
|
|||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase|0|UINT32|0x10000001
|
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase|0|UINT32|0x10000001
|
||||||
## Provides the size of the payload binary in memory
|
## Provides the size of the payload binary in memory
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize|0|UINT32|0x10000002
|
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize|0|UINT32|0x10000002
|
||||||
## Payload stack top
|
## Save bootloader parameter
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop|0x90000|UINT32|0x10000004
|
gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter|0|UINT64|0x10000004
|
||||||
|
|
||||||
## FFS filename to find the shell application.
|
## FFS filename to find the shell application.
|
||||||
gUefiPayloadPkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1c, 0x4f, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }|VOID*|0x10000005
|
gUefiPayloadPkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1c, 0x4f, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }|VOID*|0x10000005
|
||||||
|
@ -169,12 +169,7 @@
|
|||||||
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
||||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
|
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
|
||||||
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
|
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
|
||||||
|
|
||||||
!if $(UNIVERSAL_PAYLOAD) == TRUE
|
|
||||||
HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf
|
HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf
|
||||||
!else
|
|
||||||
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
|
||||||
!endif
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# UEFI & PI
|
# UEFI & PI
|
||||||
@ -217,11 +212,7 @@
|
|||||||
TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
|
TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
|
||||||
ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf
|
ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf
|
||||||
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
|
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
|
||||||
!if $(UNIVERSAL_PAYLOAD) == TRUE
|
|
||||||
PlatformHookLib|UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf
|
|
||||||
!else
|
|
||||||
PlatformHookLib|UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
|
PlatformHookLib|UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
|
||||||
!endif
|
|
||||||
PlatformBootManagerLib|UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
|
PlatformBootManagerLib|UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
|
||||||
IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
|
IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
|
||||||
|
|
||||||
@ -366,6 +357,7 @@
|
|||||||
|
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|$(MAX_LOGICAL_PROCESSORS)
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|$(MAX_LOGICAL_PROCESSORS)
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs|0
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs|0
|
||||||
|
gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter|0
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user