Skip to content

Commit 5188c6c

Browse files
author
Laszlo Ersek
committed
OvmfPkg: S3 Suspend: pull in DXE driver for EFI_SMM_COMMUNICATION_PROTOCOL
The low-level data transfer between S3 Suspend and S3 Resume happens thru SMRAM. SMRAM is theoretically accessible to SMM drivers only; other ("untrusted") drivers can only talk to the former via EFI_SMM_COMMUNICATION_PROTOCOL. "MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf" implements the SMM Initial Program Loader. It produces EFI_SMM_BASE2_PROTOCOL and EFI_SMM_COMMUNICATION_PROTOCOL, relying on the previous patch: EFI_SMM_COMMUNICATION_PROTOCOL [PiSmmCore] EFI_SMM_ACCESS2_PROTOCOL [EmuSmmDxe] EFI_SMM_CONTROL2_PROTOCOL [EmuSmmDxe] EFI_SMM_BASE2_PROTOCOL [PiSmmCore] EFI_SMM_ACCESS2_PROTOCOL [EmuSmmDxe] EFI_SMM_CONTROL2_PROTOCOL [EmuSmmDxe] The SMM IPL loads the SMM Core into SMRAM and executes it from there. Therefore we need to add the SMM Core to the build as well. The SMM Core introduces further DSC dependencies: - library classes that are specific to it (SmmCorePlatformHookLib), - library instances that are specific to it (PiSmmCoreMemoryAllocationLib), - the ReportStatusCodeLib dependency can be resolved by the already used DxeReportStatusCodeLib (it serves SMM_CORE as well) - DebugLib simply needs to be resolved (both serial and qemu debug port implementations are BASE) ...and FDF / Rule dependencies: - we introduce an SMM_CORE rule that imitates DXE_CORE (since the contents is a core binary that will be executed after relocation) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com>
1 parent 59fc7eb commit 5188c6c

File tree

6 files changed

+63
-0
lines changed

6 files changed

+63
-0
lines changed

OvmfPkg/OvmfPkgIa32.dsc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,16 @@
254254
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
255255
!endif
256256

257+
[LibraryClasses.common.SMM_CORE]
258+
SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf
259+
MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf
260+
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
261+
!ifdef $(DEBUG_ON_SERIAL_PORT)
262+
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
263+
!else
264+
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
265+
!endif
266+
257267
################################################################################
258268
#
259269
# Pcd Section - list of all EDK II PCD Entries defined by this Platform.
@@ -471,6 +481,8 @@
471481
# SMM Support
472482
#
473483
OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
484+
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
485+
MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
474486

475487
#
476488
# ACPI Support

OvmfPkg/OvmfPkgIa32.fdf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
316316
INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
317317

318318
INF OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
319+
INF MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
320+
INF MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
319321

320322
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
321323
INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -491,3 +493,10 @@ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
491493
FILE RAW = $(NAMED_GUID) {
492494
RAW RAW |.raw
493495
}
496+
497+
[Rule.Common.SMM_CORE]
498+
FILE SMM_CORE = $(NAMED_GUID) {
499+
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
500+
UI STRING="$(MODULE_NAME)" Optional
501+
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
502+
}

OvmfPkg/OvmfPkgIa32X64.dsc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@
259259
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
260260
!endif
261261

262+
[LibraryClasses.common.SMM_CORE]
263+
SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf
264+
MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf
265+
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
266+
!ifdef $(DEBUG_ON_SERIAL_PORT)
267+
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
268+
!else
269+
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
270+
!endif
271+
262272
################################################################################
263273
#
264274
# Pcd Section - list of all EDK II PCD Entries defined by this Platform.
@@ -478,6 +488,8 @@
478488
# SMM Support
479489
#
480490
OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
491+
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
492+
MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
481493

482494
#
483495
# ACPI Support

OvmfPkg/OvmfPkgIa32X64.fdf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
316316
INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
317317

318318
INF OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
319+
INF MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
320+
INF MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
319321

320322
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
321323
INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -491,3 +493,10 @@ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
491493
FILE RAW = $(NAMED_GUID) {
492494
RAW RAW |.raw
493495
}
496+
497+
[Rule.Common.SMM_CORE]
498+
FILE SMM_CORE = $(NAMED_GUID) {
499+
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
500+
UI STRING="$(MODULE_NAME)" Optional
501+
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
502+
}

OvmfPkg/OvmfPkgX64.dsc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@
259259
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
260260
!endif
261261

262+
[LibraryClasses.common.SMM_CORE]
263+
SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf
264+
MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf
265+
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
266+
!ifdef $(DEBUG_ON_SERIAL_PORT)
267+
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
268+
!else
269+
DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
270+
!endif
271+
262272
################################################################################
263273
#
264274
# Pcd Section - list of all EDK II PCD Entries defined by this Platform.
@@ -476,6 +486,8 @@
476486
# SMM Support
477487
#
478488
OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
489+
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
490+
MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
479491

480492
#
481493
# ACPI Support

OvmfPkg/OvmfPkgX64.fdf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
316316
INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
317317

318318
INF OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
319+
INF MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
320+
INF MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
319321

320322
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
321323
INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -491,3 +493,10 @@ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
491493
FILE RAW = $(NAMED_GUID) {
492494
RAW RAW |.raw
493495
}
496+
497+
[Rule.Common.SMM_CORE]
498+
FILE SMM_CORE = $(NAMED_GUID) {
499+
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
500+
UI STRING="$(MODULE_NAME)" Optional
501+
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
502+
}

0 commit comments

Comments
 (0)