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 3919444..ecce4fe 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -256,10 +256,20 @@
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
 !else
   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.
 #
 
################################################################################
@@ -491,10 +501,12 @@
 
   #
   # SMM Support
   #
   OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
+  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
+  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 42294e8..34cf4ed 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -362,10 +362,12 @@ INF  
IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
 
 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
 INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
 
@@ -537,5 +539,12 @@ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
 
 [Rule.Common.SEC.RESET_VECTOR]
   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



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&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