]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: LockBox: use SMM stack with -D SMM_REQUIRE
authorLaszlo Ersek <lersek@redhat.com>
Mon, 30 Nov 2015 18:42:15 +0000 (18:42 +0000)
committerlersek <lersek@Edk2>
Mon, 30 Nov 2015 18:42:15 +0000 (18:42 +0000)
During DXE, drivers save data in the LockBox. A save operation is layered
as follows:

- The unprivileged driver wishing to store data in the LockBox links
  against the "MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf"
  library instance.

  The library allows the unprivileged driver to format requests for the
  privileged SMM LockBox driver (see below), and to parse responses.

  We apply this resolution for DXE_DRIVER modules.

- The privileged SMM LockBox driver is built from
  "MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf". This driver
  has module type DXE_SMM_DRIVER and can access SMRAM.

  The driver delegates command parsing and response formatting to
  "MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf".

  Therefore we include this DXE_SMM_DRIVER in the build, and apply said
  resolution specifically to it.

  (Including the driver requires us to resolve a few of other library
  classes for DXE_SMM_DRIVER modules.)

- In PEI, the S3 Resume PEIM (UefiCpuPkg/Universal/Acpi/S3Resume2Pei)
  retrieves data from the LockBox. It is capable of searching SMRAM
  itself.

  We resolve LockBoxLib to
  "MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf" specifically
  for this one PEIM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19048 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32.fdf
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgIa32X64.fdf
OvmfPkg/OvmfPkgX64.dsc
OvmfPkg/OvmfPkgX64.fdf

index 413e05163a074214146628c72e10a6897a257e99..4789d25363b4ad8745539b2802ed730497f3aec2 100644 (file)
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf\r
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf\r
   LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf\r
+!if $(SMM_REQUIRE) == FALSE\r
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf\r
+!endif\r
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf\r
 \r
 !ifdef $(SOURCE_DEBUG_ENABLE)\r
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf\r
   PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf\r
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf\r
+!if $(SMM_REQUIRE) == TRUE\r
+  LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf\r
+!else\r
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf\r
+!endif\r
 !ifdef $(SOURCE_DEBUG_ENABLE)\r
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf\r
 !endif\r
 [LibraryClasses.common.DXE_SMM_DRIVER]\r
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
   TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf\r
+  MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf\r
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
+  SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf\r
   SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf\r
 !ifdef $(DEBUG_ON_SERIAL_PORT)\r
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf\r
   UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf {\r
     <LibraryClasses>\r
       PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf\r
+!if $(SMM_REQUIRE) == TRUE\r
+      LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf\r
+!endif\r
   }\r
 !if $(SMM_REQUIRE) == TRUE\r
   OvmfPkg/SmmAccess/SmmAccessPei.inf {\r
   # Privileged drivers (DXE_SMM_DRIVER modules)\r
   #\r
   UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf\r
+  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf {\r
+    <LibraryClasses>\r
+      LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf\r
+  }\r
 !endif\r
index e34093c5df2e3cb01a20a4ef98eba2f82aff5b93..7b510b8abcbdd9d3b94e8120aa2016919beaeb87 100644 (file)
@@ -361,6 +361,7 @@ INF  OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf\r
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf\r
 INF  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf\r
+INF  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf\r
 !endif\r
 \r
 ################################################################################\r
index aa8c76d4d5ad8a9a51907231b27cea57dfc630b5..8e53910d80cdb333177d006f784679d69306e09b 100644 (file)
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf\r
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf\r
   LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf\r
+!if $(SMM_REQUIRE) == FALSE\r
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf\r
+!endif\r
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf\r
 \r
 !ifdef $(SOURCE_DEBUG_ENABLE)\r
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf\r
   PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf\r
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf\r
+!if $(SMM_REQUIRE) == TRUE\r
+  LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf\r
+!else\r
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf\r
+!endif\r
 !ifdef $(SOURCE_DEBUG_ENABLE)\r
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf\r
 !endif\r
 [LibraryClasses.common.DXE_SMM_DRIVER]\r
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
   TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf\r
+  MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf\r
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
+  SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf\r
   SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf\r
 !ifdef $(DEBUG_ON_SERIAL_PORT)\r
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf\r
   UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf {\r
     <LibraryClasses>\r
       PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf\r
+!if $(SMM_REQUIRE) == TRUE\r
+      LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf\r
+!endif\r
   }\r
 !if $(SMM_REQUIRE) == TRUE\r
   OvmfPkg/SmmAccess/SmmAccessPei.inf {\r
   # Privileged drivers (DXE_SMM_DRIVER modules)\r
   #\r
   UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf\r
+  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf {\r
+    <LibraryClasses>\r
+      LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf\r
+  }\r
 !endif\r
index 165fd053b41f5358d111eb1b6754ec726ca2a3ad..674932c76e52ee3a02b1b1c3583a6082ae41e731 100644 (file)
@@ -361,6 +361,7 @@ INF  OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf\r
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf\r
 INF  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf\r
+INF  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf\r
 !endif\r
 \r
 ################################################################################\r
index d5fac2510422a8401a4b9d332e933d39d901fa91..e28d535b623af92055fd761dea14cbae9631d376 100644 (file)
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf\r
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf\r
   LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf\r
+!if $(SMM_REQUIRE) == FALSE\r
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf\r
+!endif\r
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf\r
 \r
 !ifdef $(SOURCE_DEBUG_ENABLE)\r
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf\r
   PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf\r
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf\r
+!if $(SMM_REQUIRE) == TRUE\r
+  LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf\r
+!else\r
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf\r
+!endif\r
 !ifdef $(SOURCE_DEBUG_ENABLE)\r
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf\r
 !endif\r
 [LibraryClasses.common.DXE_SMM_DRIVER]\r
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
   TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf\r
+  MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf\r
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
+  SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf\r
   SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf\r
 !ifdef $(DEBUG_ON_SERIAL_PORT)\r
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf\r
   UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf {\r
     <LibraryClasses>\r
       PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf\r
+!if $(SMM_REQUIRE) == TRUE\r
+      LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf\r
+!endif\r
   }\r
 !if $(SMM_REQUIRE) == TRUE\r
   OvmfPkg/SmmAccess/SmmAccessPei.inf {\r
   # Privileged drivers (DXE_SMM_DRIVER modules)\r
   #\r
   UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf\r
+  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf {\r
+    <LibraryClasses>\r
+      LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf\r
+  }\r
 !endif\r
index 9bfeb35afefa37d34bfa5cb21d6b80be4e9531fd..85827bce5aec7308d354aef368a813e1f29be403 100644 (file)
@@ -361,6 +361,7 @@ INF  OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf\r
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf\r
 INF  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf\r
+INF  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf\r
 !endif\r
 \r
 ################################################################################\r