This patch just separates the smbase relocation logic from PiSmmCpuDxeSmm driver, and moves to the SmmRelocationInit interface. It maintains the original implementation of most functions and leaves the definitions of global variables intact. Further refinements to the code are planned for subsequent patches. Platform shall consume the interface for the smbase relocation if need SMM support. Note: Before using SmmRelocationLib, the PiSmmCpuDxeSmm driver allocates the SMRAM to be used for SMI handler and Save state area of each processor from Smst->AllocatePages(). With SmmRelocationLib, the SMRAM allocation for SMI handlers and Save state areas is moved to early PEI phase (Smst->AllocatePages() service is not available). So, the allocation is done by splitting the SMRAM out of the SMRAM regions reported from gEfiSmmSMramMemoryGuid. So, Platform must produce the gEfiSmmSMramMemoryGuid HOB for SmmRelocationLib usage. Cc: Ray Ni <ray.ni@intel.com> Cc: Zeng Star <star.zeng@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
62 lines
1.5 KiB
INI
62 lines
1.5 KiB
INI
## @file
|
|
# SMM Relocation Lib for each processor.
|
|
#
|
|
# This Lib produces the SMM_BASE_HOB in HOB database which tells
|
|
# the PiSmmCpuDxeSmm driver (runs at a later phase) about the new
|
|
# SMBASE for each processor. PiSmmCpuDxeSmm driver installs the
|
|
# SMI handler at the SMM_BASE_HOB.SmBase[Index]+0x8000 for processor
|
|
# Index.
|
|
#
|
|
# Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
#
|
|
##
|
|
|
|
[Defines]
|
|
INF_VERSION = 0x00010005
|
|
BASE_NAME = SmmRelocationLib
|
|
FILE_GUID = 853E97B3-790C-4EA3-945C-8F622FC47FE8
|
|
MODULE_TYPE = PEIM
|
|
VERSION_STRING = 1.0
|
|
LIBRARY_CLASS = SmmRelocationLib
|
|
|
|
[Sources]
|
|
InternalSmmRelocationLib.h
|
|
SmramSaveStateConfig.c
|
|
SmmRelocationLib.c
|
|
|
|
[Sources.Ia32]
|
|
Ia32/Semaphore.c
|
|
Ia32/SmmInit.nasm
|
|
|
|
[Sources.X64]
|
|
X64/Semaphore.c
|
|
X64/SmmInit.nasm
|
|
|
|
[Packages]
|
|
MdePkg/MdePkg.dec
|
|
MdeModulePkg/MdeModulePkg.dec
|
|
UefiCpuPkg/UefiCpuPkg.dec
|
|
|
|
[LibraryClasses]
|
|
BaseLib
|
|
BaseMemoryLib
|
|
CpuExceptionHandlerLib
|
|
CpuLib
|
|
DebugLib
|
|
HobLib
|
|
LocalApicLib
|
|
MemoryAllocationLib
|
|
PcdLib
|
|
PeiServicesLib
|
|
|
|
[Guids]
|
|
gSmmBaseHobGuid ## HOB ALWAYS_PRODUCED
|
|
gEfiSmmSmramMemoryGuid ## CONSUMES
|
|
|
|
[Pcd]
|
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber
|
|
|
|
[FeaturePcd]
|
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugSupport ## CONSUMES
|