OvmfPkg: add PEIM for providing TSEG-as-SMRAM during PEI
"MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf" is the
LockBoxLib instance with SMRAM access for the PEI phase.
Said library instance must, and can, access the LockBox data in SMRAM
directly if it is invoked before SMBASE relocation / SMI handler
installation. In that case, it only needs PEI_SMM_ACCESS_PPI from the
platform, and it doesn't depend on EFI_PEI_SMM_COMMUNICATION_PPI.
OVMF satisfies the description in SVN r18823 ("MdeModulePkg:
SmmLockBoxPeiLib: work without EFI_PEI_SMM_COMMUNICATION_PPI"): in OVMF,
only S3Resume2Pei links against SmmLockBoxPeiLib.
Therefore, introduce a PEIM that produces the PEI_SMM_ACCESS_PPI
interface, enabling SmmLockBoxPeiLib to work; we can omit including
"UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf".
The load / installation order of S3Resume2Pei and SmmAccessPei is
indifferent. SmmAccessPei produces the gEfiAcpiVariableGuid HOB during its
installation (which happens during PEI), but S3Resume2Pei accesses the HOB
only when the DXE IPL calls its S3RestoreConfig2 PPI member, as last act
of PEI.
MCH_SMRAM_D_LCK and MCH_ESMRAMC_T_EN are masked out the way they are, in
SmmAccessPeiEntryPoint() and SmramAccessOpen() respectively, in order to
prevent VS20xx from warning about the (otherwise fully intentional)
truncation in the UINT8 casts. (Warnings reported by Michael Kinney.)
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19040 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-30 19:41:38 +01:00
|
|
|
## @file
|
|
|
|
# A PEIM with the following responsibilities:
|
|
|
|
#
|
|
|
|
# - provide SMRAM access by producing PEI_SMM_ACCESS_PPI,
|
|
|
|
# - verify & configure the Q35 TSEG in the entry point,
|
|
|
|
# - set aside the SMM_S3_RESUME_STATE object at the bottom of TSEG, and expose
|
|
|
|
# it via the gEfiAcpiVariableGuid GUIDed HOB.
|
|
|
|
#
|
|
|
|
# Copyright (C) 2013, 2015, Red Hat, Inc.
|
|
|
|
#
|
|
|
|
# This program and the accompanying materials are licensed and made available
|
|
|
|
# under the terms and conditions of the BSD License which accompanies this
|
|
|
|
# distribution. The full text of the license may be found at
|
|
|
|
# http://opensource.org/licenses/bsd-license.php
|
|
|
|
#
|
|
|
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
#
|
|
|
|
##
|
|
|
|
|
|
|
|
[Defines]
|
|
|
|
INF_VERSION = 0x00010005
|
|
|
|
BASE_NAME = SmmAccessPei
|
|
|
|
FILE_GUID = 6C0E75B4-B0B9-44D1-8210-3377D7B4E066
|
|
|
|
MODULE_TYPE = PEIM
|
|
|
|
VERSION_STRING = 1.0
|
|
|
|
ENTRY_POINT = SmmAccessPeiEntryPoint
|
|
|
|
|
|
|
|
#
|
|
|
|
# The following information is for reference only and not required by the build tools.
|
|
|
|
#
|
|
|
|
# VALID_ARCHITECTURES = IA32 X64
|
|
|
|
#
|
|
|
|
|
|
|
|
[Sources]
|
|
|
|
SmmAccessPei.c
|
|
|
|
SmramInternal.c
|
|
|
|
SmramInternal.h
|
|
|
|
|
|
|
|
[Packages]
|
|
|
|
MdeModulePkg/MdeModulePkg.dec
|
|
|
|
MdePkg/MdePkg.dec
|
|
|
|
OvmfPkg/OvmfPkg.dec
|
|
|
|
|
|
|
|
[Guids]
|
|
|
|
gEfiAcpiVariableGuid
|
|
|
|
|
|
|
|
[LibraryClasses]
|
|
|
|
BaseLib
|
|
|
|
BaseMemoryLib
|
|
|
|
DebugLib
|
|
|
|
HobLib
|
|
|
|
IoLib
|
|
|
|
PcdLib
|
|
|
|
PciLib
|
|
|
|
PeiServicesLib
|
|
|
|
PeimEntryPoint
|
|
|
|
|
|
|
|
[FeaturePcd]
|
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
|
|
|
|
|
2017-07-04 13:16:39 +02:00
|
|
|
[Pcd]
|
OvmfPkg: add PEIM for providing TSEG-as-SMRAM during PEI
"MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf" is the
LockBoxLib instance with SMRAM access for the PEI phase.
Said library instance must, and can, access the LockBox data in SMRAM
directly if it is invoked before SMBASE relocation / SMI handler
installation. In that case, it only needs PEI_SMM_ACCESS_PPI from the
platform, and it doesn't depend on EFI_PEI_SMM_COMMUNICATION_PPI.
OVMF satisfies the description in SVN r18823 ("MdeModulePkg:
SmmLockBoxPeiLib: work without EFI_PEI_SMM_COMMUNICATION_PPI"): in OVMF,
only S3Resume2Pei links against SmmLockBoxPeiLib.
Therefore, introduce a PEIM that produces the PEI_SMM_ACCESS_PPI
interface, enabling SmmLockBoxPeiLib to work; we can omit including
"UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf".
The load / installation order of S3Resume2Pei and SmmAccessPei is
indifferent. SmmAccessPei produces the gEfiAcpiVariableGuid HOB during its
installation (which happens during PEI), but S3Resume2Pei accesses the HOB
only when the DXE IPL calls its S3RestoreConfig2 PPI member, as last act
of PEI.
MCH_SMRAM_D_LCK and MCH_ESMRAMC_T_EN are masked out the way they are, in
SmmAccessPeiEntryPoint() and SmramAccessOpen() respectively, in order to
prevent VS20xx from warning about the (otherwise fully intentional)
truncation in the UINT8 casts. (Warnings reported by Michael Kinney.)
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19040 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-30 19:41:38 +01:00
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes
|
|
|
|
|
|
|
|
[Ppis]
|
|
|
|
gPeiSmmAccessPpiGuid ## PRODUCES
|
|
|
|
|
|
|
|
[Depex]
|
2017-07-04 13:16:39 +02:00
|
|
|
gEfiPeiMemoryDiscoveredPpiGuid
|