]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: QemuFlashFvbServicesRuntimeDxe: add DXE_SMM_DRIVER build
authorLaszlo Ersek <lersek@redhat.com>
Mon, 30 Nov 2015 18:48:50 +0000 (18:48 +0000)
committerlersek <lersek@Edk2>
Mon, 30 Nov 2015 18:48:50 +0000 (18:48 +0000)
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@19062 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf [new file with mode: 0644]
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c [new file with mode: 0644]

diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
new file mode 100644 (file)
index 0000000..6af0649
--- /dev/null
@@ -0,0 +1,89 @@
+## @file\r
+#  Component description file for QEMU Flash Fimware Volume Block SMM driver\r
+#  module.\r
+#\r
+#  This SMM driver implements and produces the SMM Fimware Volue Block Protocol\r
+#  for a QEMU flash device.\r
+#\r
+#  Copyright (C) 2015, Red Hat, Inc.\r
+#  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  This program and the accompanying materials are licensed and made available\r
+#  under the terms and conditions of the BSD License which accompanies this\r
+#  distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR\r
+#  IMPLIED.\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = FvbServicesSmm\r
+  FILE_GUID                      = 2E7DB7A7-608E-4041-B45F-00359E0766C6\r
+  MODULE_TYPE                    = DXE_SMM_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  PI_SPECIFICATION_VERSION       = 0x0001000A\r
+  ENTRY_POINT                    = FvbInitialize\r
+\r
+#\r
+# The following information is for reference only and not required by the build\r
+# tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64\r
+#\r
+\r
+[Sources]\r
+  FvbInfo.c\r
+  FwBlockService.c\r
+  FwBlockServiceSmm.c\r
+  QemuFlash.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
+  OvmfPkg/OvmfPkg.dec\r
+\r
+[LibraryClasses]\r
+  BaseLib\r
+  BaseMemoryLib\r
+  DebugLib\r
+  DevicePathLib\r
+  DxeServicesTableLib\r
+  MemoryAllocationLib\r
+  PcdLib\r
+  SmmServicesTableLib\r
+  UefiBootServicesTableLib\r
+  UefiDriverEntryPoint\r
+\r
+[Guids]\r
+\r
+[Protocols]\r
+  gEfiSmmFirmwareVolumeBlockProtocolGuid        # PROTOCOL ALWAYS_PRODUCED\r
+  gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_PRODUCED\r
+\r
+[FixedPcd]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize\r
+\r
+[Pcd]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable\r
+\r
+\r
+[Depex]\r
+  TRUE\r
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c
new file mode 100644 (file)
index 0000000..e77129e
--- /dev/null
@@ -0,0 +1,66 @@
+/**@file\r
+  Functions related to the Firmware Volume Block service whose\r
+  implementation is specific to the SMM driver build.\r
+\r
+  Copyright (C) 2015, Red Hat, Inc.\r
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials are licensed and made available\r
+  under the terms and conditions of the BSD License which accompanies this\r
+  distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/SmmServicesTableLib.h>\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/SmmFirmwareVolumeBlock.h>\r
+\r
+#include "FwBlockService.h"\r
+\r
+VOID\r
+InstallProtocolInterfaces (\r
+  IN EFI_FW_VOL_BLOCK_DEVICE *FvbDevice\r
+  )\r
+{\r
+  EFI_HANDLE FvbHandle;\r
+  EFI_STATUS Status;\r
+\r
+  //\r
+  // There is no SMM service that can install multiple protocols in the SMM\r
+  // protocol database in one go.\r
+  //\r
+  // The SMM Firmware Volume Block protocol structure is the same as the\r
+  // Firmware Volume Block protocol structure.\r
+  //\r
+  FvbHandle = NULL;\r
+  DEBUG ((EFI_D_INFO, "Installing QEMU flash SMM FVB\n"));\r
+  Status = gSmst->SmmInstallProtocolInterface (\r
+                    &FvbHandle,\r
+                    &gEfiSmmFirmwareVolumeBlockProtocolGuid,\r
+                    EFI_NATIVE_INTERFACE,\r
+                    &FvbDevice->FwVolBlockInstance\r
+                    );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  Status = gSmst->SmmInstallProtocolInterface (\r
+                    &FvbHandle,\r
+                    &gEfiDevicePathProtocolGuid,\r
+                    EFI_NATIVE_INTERFACE,\r
+                    FvbDevice->DevicePath\r
+                    );\r
+  ASSERT_EFI_ERROR (Status);\r
+}\r
+\r
+VOID\r
+InstallVirtualAddressChangeHandler (\r
+  VOID\r
+  )\r
+{\r
+  //\r
+  // Nothing.\r
+  //\r
+}\r