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 <ler...@redhat.com>
---
 OvmfPkg/OvmfPkgX64.dsc | 12 ++++++++++++
 OvmfPkg/OvmfPkgX64.fdf |  9 +++++++++
 2 files changed, 21 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index cef5113..351ec73 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -258,6 +258,16 @@
   DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
 !endif
 
+[LibraryClasses.common.SMM_CORE]
+  
SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf
+  
MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf
+  
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+!ifdef $(DEBUG_ON_SERIAL_PORT)
+  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+!else
+  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+!endif
+
 
################################################################################
 #
 # Pcd Section - list of all EDK II PCD Entries defined by this Platform.
@@ -497,6 +507,8 @@
   # SMM Support
   #
   OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
+  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
+  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
 
   #
   # ACPI Support
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 42294e8..34cf4ed 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -364,6 +364,8 @@ INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
 INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
 INF  OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
+INF  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
+INF  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
 INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -539,3 +541,10 @@ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
   FILE RAW = $(NAMED_GUID) {
     RAW RAW                |.raw
   }
+
+[Rule.Common.SMM_CORE]
+  FILE SMM_CORE = $(NAMED_GUID) {
+    PE32     PE32           $(INF_OUTPUT)/$(MODULE_NAME).efi
+    UI       STRING="$(MODULE_NAME)" Optional
+    VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
-- 
1.8.3.1



------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to