]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.c
OVMF: Add library to customize the EMU Variable FVB driver.
[mirror_edk2.git] / OvmfPkg / Library / EmuVariableFvbLib / EmuVariableFvbLib.c
diff --git a/OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.c b/OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.c
new file mode 100644 (file)
index 0000000..d16be5a
--- /dev/null
@@ -0,0 +1,50 @@
+/** @file\r
+  OVMF platform customization for EMU Variable FVB driver\r
+\r
+  Copyright (c) 2009, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this 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
+\r
+#include "PiDxe.h"\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/PlatformFvbLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiRuntimeLib.h>\r
+\r
+\r
+/**\r
+  This function will be called following a call to the\r
+  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL Write function.\r
+\r
+  @param[in] This     EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL instance.\r
+  @param[in] Lba      The starting logical block index to written to.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PlatformFvbDataWritten (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  IN        EFI_LBA                             Lba\r
+  )\r
+{\r
+  STATIC EFI_EVENT EventToSignal = NULL;\r
+\r
+  if (!EfiAtRuntime ()) {\r
+    if (EventToSignal == NULL) {\r
+      EventToSignal = (EFI_EVENT)(UINTN) PcdGet64 (PcdEmuVariableEvent);\r
+    }\r
+    if (EventToSignal != NULL) {\r
+      gBS->SignalEvent (EventToSignal);\r
+    }\r
+  }\r
+}\r
+\r
+\r