Simics QSP platform always supports flash devices.
The logic that was ported from OVMF where the flash devices might
not be supported in some configurations is useless in QSP platform.
So, the patch removes all of them.

Signed-off-by: Ray Ni <ray...@intel.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Cc: Zhiguang Liu <zhiguang@l...@intel.com>
Cc: Michael D Kinney <michael.d.kin...@intel.com>
---
 .../BoardX58Ich10/OpenBoardPkg.dsc            |   2 -
 .../Include/Library/SerializeVariablesLib.h   | 224 -----
 .../Library/BoardBdsHookLib/BoardBdsHookLib.c | 124 ---
 .../BoardBdsHookLib/BoardBdsHookLib.inf       |   3 -
 .../Library/NvVarsFileLib/FsAccess.c          | 507 ----------
 .../Library/NvVarsFileLib/NvVarsFileLib.c     |  77 --
 .../Library/NvVarsFileLib/NvVarsFileLib.h     |  55 --
 .../Library/NvVarsFileLib/NvVarsFileLib.inf   |  53 --
 .../SerializeVariablesLib.c                   | 869 ------------------
 .../SerializeVariablesLib.h                   |  33 -
 .../SerializeVariablesLib.inf                 |  36 -
 .../Intel/SimicsOpenBoardPkg/OpenBoardPkg.dec |   3 -
 12 files changed, 1986 deletions(-)
 delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/Include/Library/SerializeVariablesLib.h
 delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/FsAccess.c
 delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.c
 delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.h
 delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
 delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
 delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.h
 delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 5ac260a26f..4e8991dbdf 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -114,9 +114,7 @@
   #######################################
   DxeLoadLinuxLib|$(BOARD_PKG)/Library/LoadLinuxLib/DxeLoadLinuxLib.inf
   LogoLib|$(BOARD_PKG)/Library/DxeLogoLib/DxeLogoLib.inf
-  NvVarsFileLib|$(BOARD_PKG)/Library/NvVarsFileLib/NvVarsFileLib.inf
   ReportFvLib|$(BOARD_PKG)/Library/PeiReportFvLib/PeiReportFvLib.inf
-  
SerializeVariablesLib|$(BOARD_PKG)/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   
SiliconPolicyInitLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyInitLib/SiliconPolicyInitLib.inf
   
SiliconPolicyUpdateLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyUpdateLib/SiliconPolicyUpdateLib.inf
   
PlatformCmosAccessLib|BoardModulePkg/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLibNull.inf
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Include/Library/SerializeVariablesLib.h 
b/Platform/Intel/SimicsOpenBoardPkg/Include/Library/SerializeVariablesLib.h
deleted file mode 100644
index c32f97d787..0000000000
--- a/Platform/Intel/SimicsOpenBoardPkg/Include/Library/SerializeVariablesLib.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/** @file
-  Serialize & Deserialize UEFI Variables
-
-  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SERIALIZE_VARIABLES_LIB__
-#define __SERIALIZE_VARIABLES_LIB__
-
-
-/**
-  Callback function for each variable
-
-  @param[in] Context - Context as sent to the iteration function
-  @param[in] VariableName - Refer to RuntimeServices GetNextVariableName
-  @param[in] VendorGuid - Refer to RuntimeServices GetNextVariableName
-  @param[in] Attributes - Refer to RuntimeServices GetVariable
-  @param[in] DataSize - Refer to RuntimeServices GetVariable
-  @param[in] Data - Refer to RuntimeServices GetVariable
-
-  @retval RETURN_SUCCESS         Continue iterating through the variables
-  @return Any RETURN_ERROR       Stop iterating through the variables
-
-**/
-typedef
-RETURN_STATUS
-(EFIAPI *VARIABLE_SERIALIZATION_ITERATION_CALLBACK)(
-  IN  VOID                         *Context,
-  IN  CHAR16                       *VariableName,
-  IN  EFI_GUID                     *VendorGuid,
-  IN  UINT32                       Attributes,
-  IN  UINTN                        DataSize,
-  IN  VOID                         *Data
-  );
-
-
-/**
-  Creates a new variable serialization instance
-
-  @param[out]  Handle - Handle for a variable serialization instance
-
-  @retval      RETURN_SUCCESS - The variable serialization instance was
-                 successfully created.
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 create the variable serialization instance.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesNewInstance (
-  OUT EFI_HANDLE                      *Handle
-  );
-
-
-/**
-  Free memory associated with a variable serialization instance
-
-  @param[in]  Handle - Handle for a variable serialization instance
-
-  @retval      RETURN_SUCCESS - The variable serialization instance was
-                 successfully freed.
-  @retval      RETURN_INVALID_PARAMETER - Handle was not a valid
-                 variable serialization instance.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesFreeInstance (
-  IN EFI_HANDLE Handle
-  );
-
-
-/**
-  Creates a new variable serialization instance using the given
-  binary representation of the variables to fill the new instance
-
-  @param[out] Handle - Handle for a variable serialization instance
-  @param[in]  Buffer - A buffer with the serialized representation
-                of the variables.  Must be the same format as produced
-                by SerializeVariablesToBuffer.
-  @param[in]  Size - This is the size of the binary representation
-                of the variables.
-
-  @retval      RETURN_SUCCESS - The binary representation was successfully
-                 imported into a new variable serialization instance
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 create the new variable serialization instance
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesNewInstanceFromBuffer (
-  OUT EFI_HANDLE                          *Handle,
-  IN  VOID                                *Buffer,
-  IN  UINTN                               Size
-  );
-
-
-/**
-  Iterates all variables found with RuntimeServices GetNextVariableName
-
-  @param[in]   CallbackFunction - Function called for each variable instance
-  @param[in]   Context - Passed to each call of CallbackFunction
-
-  @retval      RETURN_SUCCESS - All variables were iterated without the
-                 CallbackFunction returning an error
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 iterate through the variables
-  @return      Any of RETURN_ERROR indicates an error reading the variable
-                 or an error was returned from CallbackFunction
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesIterateSystemVariables (
-  IN VARIABLE_SERIALIZATION_ITERATION_CALLBACK CallbackFunction,
-  IN VOID                                      *Context
-  );
-
-
-/**
-  Iterates all variables found in the variable serialization instance
-
-  @param[in]   Handle - Handle for a variable serialization instance
-  @param[in]   CallbackFunction - Function called for each variable instance
-  @param[in]   Context - Passed to each call of CallbackFunction
-
-  @retval      RETURN_SUCCESS - All variables were iterated without the
-                 CallbackFunction returning an error
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 iterate through the variables
-  @return      Any of RETURN_ERROR indicates an error reading the variable
-                 or an error was returned from CallbackFunction
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesIterateInstanceVariables (
-  IN EFI_HANDLE                                Handle,
-  IN VARIABLE_SERIALIZATION_ITERATION_CALLBACK CallbackFunction,
-  IN VOID                                      *Context
-  );
-
-
-/**
-  Sets all variables found in the variable serialization instance
-
-  @param[in]   Handle - Handle for a variable serialization instance
-
-  @retval      RETURN_SUCCESS - All variables were set successfully
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 set all the variables
-  @return      Any of RETURN_ERROR indicates an error reading the variables
-                 or in attempting to set a variable
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesSetSerializedVariables (
-  IN EFI_HANDLE                       Handle
-  );
-
-
-/**
-  Adds a variable to the variable serialization instance
-
-  @param[in] Handle - Handle for a variable serialization instance
-  @param[in] VariableName - Refer to RuntimeServices GetVariable
-  @param[in] VendorGuid - Refer to RuntimeServices GetVariable
-  @param[in] Attributes - Refer to RuntimeServices GetVariable
-  @param[in] DataSize - Refer to RuntimeServices GetVariable
-  @param[in] Data - Refer to RuntimeServices GetVariable
-
-  @retval      RETURN_SUCCESS - All variables were set successfully
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 add the variable
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesAddVariable (
-  IN EFI_HANDLE                   Handle,
-  IN CHAR16                       *VariableName,
-  IN EFI_GUID                     *VendorGuid,
-  IN UINT32                       Attributes,
-  IN UINTN                        DataSize,
-  IN VOID                         *Data
-  );
-
-
-/**
-  Serializes the variables known to this instance into the
-  provided buffer.
-
-  @param[in]     Handle - Handle for a variable serialization instance
-  @param[out]    Buffer - A buffer to store the binary representation
-                   of the variables.
-  @param[in,out] Size - On input this is the size of the buffer.
-                   On output this is the size of the binary representation
-                   of the variables.
-
-  @retval      RETURN_SUCCESS - The binary representation was successfully
-                 completed and returned in the buffer.
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 save the variables to the buffer.
-  @retval      RETURN_INVALID_PARAMETER - Handle was not a valid
-                 variable serialization instance or
-                 Size or Buffer were NULL.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesToBuffer (
-  IN     EFI_HANDLE                       Handle,
-  OUT    VOID                             *Buffer,
-  IN OUT UINTN                            *Size
-  );
-
-
-#endif
-
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c 
b/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
index ba4d2b02d8..3c6385c12f 100644
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
+++ 
b/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
@@ -1111,119 +1111,6 @@ PciAcpiInitialization (
   Interrupt8259WriteMask(0xFFFF, 0x0000);
 }
 
-EFI_STATUS
-EFIAPI
-ConnectRecursivelyIfPciMassStorage (
-  IN EFI_HANDLE           Handle,
-  IN EFI_PCI_IO_PROTOCOL  *Instance,
-  IN PCI_TYPE00           *PciHeader
-  )
-{
-  EFI_STATUS                Status;
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  CHAR16                    *DevPathStr;
-
-  //
-  // Recognize PCI Mass Storage
-  //
-  if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) {
-    DevicePath = NULL;
-    Status = gBS->HandleProtocol (
-                    Handle,
-                    &gEfiDevicePathProtocolGuid,
-                    (VOID*)&DevicePath
-                    );
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-
-    //
-    // Print Device Path
-    //
-    DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
-    if (DevPathStr != NULL) {
-      DEBUG(( DEBUG_INFO, "Found Mass Storage device: %s\n", DevPathStr));
-      FreePool(DevPathStr);
-    }
-
-    Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-
-   }
-
-  return EFI_SUCCESS;
-}
-
-
-/**
-  This notification function is invoked when the
-  EMU Variable FVB has been changed.
-
-  @param  Event                 The event that occurred
-  @param  Context               For EFI compatibility.  Not used.
-
-**/
-VOID
-EFIAPI
-EmuVariablesUpdatedCallback (
-  IN  EFI_EVENT Event,
-  IN  VOID      *Context
-  )
-{
-  DEBUG ((DEBUG_INFO, "%a called\n", __FUNCTION__));
-  UpdateNvVarsOnFileSystem ();
-}
-
-
-EFI_STATUS
-EFIAPI
-VisitingFileSystemInstance (
-  IN EFI_HANDLE  Handle,
-  IN VOID        *Instance,
-  IN VOID        *Context
-  )
-{
-  EFI_STATUS      Status;
-  STATIC BOOLEAN  ConnectedToFileSystem = FALSE;
-
-  if (ConnectedToFileSystem) {
-    return EFI_ALREADY_STARTED;
-  }
-
-  Status = ConnectNvVarsToFileSystem (Handle);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  ConnectedToFileSystem = TRUE;
-  mEmuVariableEvent =
-    EfiCreateProtocolNotifyEvent (
-      &gEfiDevicePathProtocolGuid,
-      TPL_CALLBACK,
-      EmuVariablesUpdatedCallback,
-      NULL,
-      &mEmuVariableEventReg
-      );
-  PcdSet64S (PcdEmuVariableEvent, (UINT64)(UINTN) mEmuVariableEvent);
-
-  return EFI_SUCCESS;
-}
-
-
-VOID
-PlatformBdsRestoreNvVarsFromHardDisk (
-  )
-{
-  VisitAllPciInstances (ConnectRecursivelyIfPciMassStorage);
-  VisitAllInstancesOfProtocol (
-    &gEfiSimpleFileSystemProtocolGuid,
-    VisitingFileSystemInstance,
-    NULL
-    );
-}
-
 /**
   Connect with predefined platform connect sequence.
 
@@ -1584,17 +1471,6 @@ BdsAfterConsoleReadyBeforeBootOptionCallback (
 
   DEBUG ((DEBUG_INFO, "%a called\n", __FUNCTION__));
 
-  if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {
-    DEBUG ((DEBUG_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "
-      "from disk since flash variables appear to be supported.\n"));
-  } else {
-    //
-    // Try to restore variables from the hard disk early so
-    // they can be used for the other BDS connect operations.
-    //
-    PlatformBdsRestoreNvVarsFromHardDisk ();
-  }
-
   //
   // Get current Boot Mode
   //
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.inf 
b/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.inf
index a77edf2699..bcfbdca996 100644
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.inf
+++ 
b/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.inf
@@ -45,14 +45,11 @@
   BootLogoLib
   DevicePathLib
   PciLib
-  NvVarsFileLib
   DxeLoadLinuxLib
   UefiLib
   LogoLib
 
 [Pcd]
-  gSimicsOpenBoardPkgTokenSpaceGuid.PcdEmuVariableEvent
-  gSimicsOpenBoardPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
   gSimicsOpenBoardPkgTokenSpaceGuid.PcdSimicsX58HostBridgePciDevId
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
   gSimicsOpenBoardPkgTokenSpaceGuid.PcdShellFile
diff --git a/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/FsAccess.c 
b/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/FsAccess.c
deleted file mode 100644
index 3d98291410..0000000000
--- a/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/FsAccess.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/** @file
-  File System Access for NvVarsFileLib
-
-  Copyright (c) 2004 - 2019 Intel Corporation. All rights reserved. <BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include "NvVarsFileLib.h"
-
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-
-/**
-  Open the NvVars file for reading or writing
-
-  @param[in]  FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
-  @param[in]  ReadingFile - TRUE: open the file for reading.  FALSE: writing
-  @param[out] NvVarsFile - If EFI_SUCCESS is returned, then this is updated
-                           with the opened NvVars file.
-
-  @return     EFI_SUCCESS if the file was opened
-
-**/
-EFI_STATUS
-GetNvVarsFile (
-  IN  EFI_HANDLE            FsHandle,
-  IN  BOOLEAN               ReadingFile,
-  OUT EFI_FILE_HANDLE       *NvVarsFile
-  )
-{
-  EFI_STATUS                            Status;
-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL       *Fs;
-  EFI_FILE_HANDLE                       Root;
-
-  //
-  // Get the FileSystem protocol on that handle
-  //
-  Status = gBS->HandleProtocol (
-                  FsHandle,
-                  &gEfiSimpleFileSystemProtocolGuid,
-                  (VOID **)&Fs
-                  );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  //
-  // Get the volume (the root directory)
-  //
-  Status = Fs->OpenVolume (Fs, &Root);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  //
-  // Attempt to open the NvVars file in the root directory
-  //
-  Status = Root->Open (
-                   Root,
-                   NvVarsFile,
-                   L"NvVars",
-                   ReadingFile ?
-                     EFI_FILE_MODE_READ :
-                     (
-                       EFI_FILE_MODE_CREATE |
-                       EFI_FILE_MODE_READ |
-                       EFI_FILE_MODE_WRITE
-                     ),
-                   0
-                   );
-
-  return Status;
-}
-
-
-/**
-  Open the NvVars file for reading or writing
-
-  @param[in]  File - The file to inspect
-  @param[out] Exists - Returns whether the file exists
-  @param[out] Size - Returns the size of the file
-                     (0 if the file does not exist)
-
-**/
-VOID
-NvVarsFileReadCheckup (
-  IN  EFI_FILE_HANDLE        File,
-  OUT BOOLEAN                *Exists,
-  OUT UINTN                  *Size
-  )
-{
-  EFI_FILE_INFO               *FileInfo;
-
-  *Exists = FALSE;
-  *Size = 0;
-
-  FileInfo = FileHandleGetInfo (File);
-  if (FileInfo == NULL) {
-    return;
-  }
-
-  if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) != 0) {
-    FreePool (FileInfo);
-    return;
-  }
-
-  *Exists = TRUE;
-  *Size = (UINTN) FileInfo->FileSize;
-
-  FreePool (FileInfo);
-}
-
-
-/**
-  Open the NvVars file for reading or writing
-
-  @param[in]  File - The file to inspect
-  @param[out] Exists - Returns whether the file exists
-  @param[out] Size - Returns the size of the file
-                     (0 if the file does not exist)
-
-**/
-EFI_STATUS
-FileHandleEmpty (
-  IN  EFI_FILE_HANDLE        File
-  )
-{
-  EFI_STATUS                  Status;
-  EFI_FILE_INFO               *FileInfo;
-
-  //
-  // Retrieve the FileInfo structure
-  //
-  FileInfo = FileHandleGetInfo (File);
-  if (FileInfo == NULL) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  //
-  // If the path is a directory, then return an error
-  //
-  if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) != 0) {
-    FreePool (FileInfo);
-    return EFI_INVALID_PARAMETER;
-  }
-
-  //
-  // If the file size is already 0, then it is empty, so
-  // we can return success.
-  //
-  if (FileInfo->FileSize == 0) {
-    FreePool (FileInfo);
-    return EFI_SUCCESS;
-  }
-
-  //
-  // Set the file size to 0.
-  //
-  FileInfo->FileSize = 0;
-  Status = FileHandleSetInfo (File, FileInfo);
-
-  FreePool (FileInfo);
-
-  return Status;
-}
-
-
-/**
-  Reads a file to a newly allocated buffer
-
-  @param[in]  File - The file to read
-  @param[in]  ReadSize - The size of data to read from the file
-
-  @return     Pointer to buffer allocated to hold the file
-              contents.  NULL if an error occurred.
-
-**/
-VOID*
-FileHandleReadToNewBuffer (
-  IN EFI_FILE_HANDLE            FileHandle,
-  IN UINTN                      ReadSize
-  )
-{
-  EFI_STATUS                  Status;
-  UINTN                       ActualReadSize;
-  VOID                        *FileContents;
-
-  ActualReadSize = ReadSize;
-  FileContents = AllocatePool (ReadSize);
-  if (FileContents != NULL) {
-    Status = FileHandleRead (
-               FileHandle,
-               &ReadSize,
-               FileContents
-               );
-    if (EFI_ERROR (Status) || (ActualReadSize != ReadSize)) {
-      FreePool (FileContents);
-      return NULL;
-    }
-  }
-
-  return FileContents;
-}
-
-
-/**
-  Reads the contents of the NvVars file on the file system
-
-  @param[in]  FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
-
-  @return     EFI_STATUS based on the success or failure of the file read
-
-**/
-EFI_STATUS
-ReadNvVarsFile (
-  IN  EFI_HANDLE            FsHandle
-  )
-{
-  EFI_STATUS                  Status;
-  EFI_FILE_HANDLE             File;
-  UINTN                       FileSize;
-  BOOLEAN                     FileExists;
-  VOID                        *FileContents;
-  EFI_HANDLE                  SerializedVariables;
-
-  Status = GetNvVarsFile (FsHandle, TRUE, &File);
-  if (EFI_ERROR (Status)) {
-    DEBUG ((EFI_D_INFO, "FsAccess.c: Could not open NV Variables file on this 
file system\n"));
-    return Status;
-  }
-
-  NvVarsFileReadCheckup (File, &FileExists, &FileSize);
-  if (FileSize == 0) {
-    FileHandleClose (File);
-    return EFI_UNSUPPORTED;
-  }
-
-  FileContents = FileHandleReadToNewBuffer (File, FileSize);
-  if (FileContents == NULL) {
-    FileHandleClose (File);
-    return EFI_UNSUPPORTED;
-  }
-
-  DEBUG ((
-    EFI_D_INFO,
-    "FsAccess.c: Read %Lu bytes from NV Variables file\n",
-    (UINT64)FileSize
-    ));
-
-  Status = SerializeVariablesNewInstanceFromBuffer (
-             &SerializedVariables,
-             FileContents,
-             FileSize
-             );
-  if (!RETURN_ERROR (Status)) {
-    Status = SerializeVariablesSetSerializedVariables (SerializedVariables);
-  }
-
-  FreePool (FileContents);
-  FileHandleClose (File);
-
-  return Status;
-}
-
-
-/**
-  Writes a variable to indicate that the NV variables
-  have been loaded from the file system.
-
-**/
-STATIC
-VOID
-SetNvVarsVariable (
-  VOID
-  )
-{
-  BOOLEAN                        VarData;
-  UINTN                          Size;
-
-  //
-  // Write a variable to indicate we've already loaded the
-  // variable data.  If it is found, we skip the loading on
-  // subsequent attempts.
-  //
-  Size = sizeof (VarData);
-  VarData = TRUE;
-  gRT->SetVariable (
-         L"NvVars",
-         &gEfiSimpleFileSystemProtocolGuid,
-         EFI_VARIABLE_NON_VOLATILE |
-           EFI_VARIABLE_BOOTSERVICE_ACCESS |
-           EFI_VARIABLE_RUNTIME_ACCESS,
-         Size,
-         (VOID*) &VarData
-         );
-}
-
-
-/**
-  Loads the non-volatile variables from the NvVars file on the
-  given file system.
-
-  @param[in]  FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
-
-  @return     EFI_STATUS based on the success or failure of load operation
-
-**/
-EFI_STATUS
-LoadNvVarsFromFs (
-  EFI_HANDLE                            FsHandle
-  )
-{
-  EFI_STATUS                     Status;
-  BOOLEAN                        VarData;
-  UINTN                          Size;
-
-  DEBUG ((EFI_D_INFO, "FsAccess.c: LoadNvVarsFromFs\n"));
-
-  //
-  // We write a variable to indicate we've already loaded the
-  // variable data.  If it is found, we skip the loading.
-  //
-  // This is relevant if the non-volatile variable have been
-  // able to survive a reboot operation.  In that case, we don't
-  // want to re-load the file as it would overwrite newer changes
-  // made to the variables.
-  //
-  Size = sizeof (VarData);
-  VarData = TRUE;
-  Status = gRT->GetVariable (
-                  L"NvVars",
-                  &gEfiSimpleFileSystemProtocolGuid,
-                  NULL,
-                  &Size,
-                  (VOID*) &VarData
-                  );
-  if (Status == EFI_SUCCESS) {
-    DEBUG ((EFI_D_INFO, "NV Variables were already loaded\n"));
-    return EFI_ALREADY_STARTED;
-  }
-
-  //
-  // Attempt to restore the variables from the NvVars file.
-  //
-  Status = ReadNvVarsFile (FsHandle);
-  if (EFI_ERROR (Status)) {
-    DEBUG ((EFI_D_INFO, "Error while restoring NV variable data\n"));
-    return Status;
-  }
-
-  //
-  // Write a variable to indicate we've already loaded the
-  // variable data.  If it is found, we skip the loading on
-  // subsequent attempts.
-  //
-  SetNvVarsVariable();
-
-  DEBUG ((
-    EFI_D_INFO,
-    "FsAccess.c: Read NV Variables file (size=%Lu)\n",
-    (UINT64)Size
-    ));
-
-  return Status;
-}
-
-
-STATIC
-RETURN_STATUS
-EFIAPI
-IterateVariablesCallbackAddAllNvVariables (
-  IN  VOID                         *Context,
-  IN  CHAR16                       *VariableName,
-  IN  EFI_GUID                     *VendorGuid,
-  IN  UINT32                       Attributes,
-  IN  UINTN                        DataSize,
-  IN  VOID                         *Data
-  )
-{
-  EFI_HANDLE  Instance;
-
-  Instance = (EFI_HANDLE) Context;
-
-  //
-  // Only save non-volatile variables
-  //
-  if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {
-    return RETURN_SUCCESS;
-  }
-
-  return SerializeVariablesAddVariable (
-           Instance,
-           VariableName,
-           VendorGuid,
-           Attributes,
-           DataSize,
-           Data
-           );
-}
-
-
-/**
-  Saves the non-volatile variables into the NvVars file on the
-  given file system.
-
-  @param[in]  FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
-
-  @return     EFI_STATUS based on the success or failure of load operation
-
-**/
-EFI_STATUS
-SaveNvVarsToFs (
-  EFI_HANDLE                            FsHandle
-  )
-{
-  EFI_STATUS                  Status;
-  EFI_FILE_HANDLE             File;
-  UINTN                       WriteSize;
-  UINTN                       VariableDataSize;
-  VOID                        *VariableData;
-  EFI_HANDLE                  SerializedVariables;
-
-  SerializedVariables = NULL;
-
-  Status = SerializeVariablesNewInstance (&SerializedVariables);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  Status = SerializeVariablesIterateSystemVariables (
-             IterateVariablesCallbackAddAllNvVariables,
-             (VOID*) SerializedVariables
-             );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  VariableData = NULL;
-  VariableDataSize = 0;
-  Status = SerializeVariablesToBuffer (
-             SerializedVariables,
-             NULL,
-             &VariableDataSize
-             );
-  if (Status == RETURN_BUFFER_TOO_SMALL) {
-    VariableData = AllocatePool (VariableDataSize);
-    if (VariableData == NULL) {
-      Status = EFI_OUT_OF_RESOURCES;
-    } else {
-      Status = SerializeVariablesToBuffer (
-                 SerializedVariables,
-                 VariableData,
-                 &VariableDataSize
-                 );
-    }
-  }
-
-  SerializeVariablesFreeInstance (SerializedVariables);
-
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  //
-  // Open the NvVars file for writing.
-  //
-  Status = GetNvVarsFile (FsHandle, FALSE, &File);
-  if (EFI_ERROR (Status)) {
-    DEBUG ((EFI_D_INFO, "FsAccess.c: Unable to open file to saved NV 
Variables\n"));
-    return Status;
-  }
-
-  //
-  // Empty the starting file contents.
-  //
-  Status = FileHandleEmpty (File);
-  if (EFI_ERROR (Status)) {
-    FileHandleClose (File);
-    return Status;
-  }
-
-  WriteSize = VariableDataSize;
-  Status = FileHandleWrite (File, &WriteSize, VariableData);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  FileHandleClose (File);
-
-  if (!EFI_ERROR (Status)) {
-    //
-    // Write a variable to indicate we've already loaded the
-    // variable data.  If it is found, we skip the loading on
-    // subsequent attempts.
-    //
-    SetNvVarsVariable();
-
-       DEBUG ((EFI_D_INFO, "Saved NV Variables to NvVars file\n"));
-  }
-
-  return Status;
-}
-
-
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.c 
b/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.c
deleted file mode 100644
index 2e9618455d..0000000000
--- a/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file
-  Save Non-Volatile Variables to a file system.
-
-  Copyright (c) 2019 Intel Corporation. All rights reserved. <BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include "NvVarsFileLib.h"
-#include <Library/DebugLib.h>
-#include <Library/NvVarsFileLib.h>
-
-EFI_HANDLE    mNvVarsFileLibFsHandle = NULL;
-
-
-/**
-  Attempts to connect the NvVarsFileLib to the specified file system.
-
-  @param[in]  FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
-
-  @return     The EFI_STATUS while attempting to connect the NvVarsFileLib
-              to the file system instance.
-  @retval     EFI_SUCCESS - The given file system was connected successfully
-
-**/
-EFI_STATUS
-EFIAPI
-ConnectNvVarsToFileSystem (
-  IN EFI_HANDLE    FsHandle
-  )
-{
-  EFI_STATUS Status;
-
-  //
-  // We might fail to load the variable, since the file system initially
-  // will not have the NvVars file.
-  //
-  LoadNvVarsFromFs (FsHandle);
-
-  //
-  // We must be able to save the variables successfully to the file system
-  // to have connected successfully.
-  //
-  Status = SaveNvVarsToFs (FsHandle);
-  if (!EFI_ERROR (Status)) {
-    mNvVarsFileLibFsHandle = FsHandle;
-  }
-
-  return Status;
-}
-
-
-/**
-  Update non-volatile variables stored on the file system.
-
-  @return     The EFI_STATUS while attempting to update the variable on
-              the connected file system.
-  @retval     EFI_SUCCESS - The non-volatile variables were saved to the disk
-  @retval     EFI_NOT_STARTED - A file system has not been connected
-
-**/
-EFI_STATUS
-EFIAPI
-UpdateNvVarsOnFileSystem (
-  )
-{
-  if (mNvVarsFileLibFsHandle == NULL) {
-    //
-    // A file system had not been connected to the library.
-    //
-    return EFI_NOT_STARTED;
-  } else {
-    return SaveNvVarsToFs (mNvVarsFileLibFsHandle);
-  }
-}
-
-
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.h 
b/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.h
deleted file mode 100644
index 80776fd003..0000000000
--- a/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
-  Save Non-Volatile Variables to a file system.
-
-  Copyright (c) 2009 - 2019 Intel Corporation. All rights reserved. <BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef __NV_VARS_FILE_LIB_INSTANCE__
-#define __NV_VARS_FILE_LIB_INSTANCE__
-
-#include <Uefi.h>
-
-#include <Guid/FileInfo.h>
-
-#include <Protocol/SimpleFileSystem.h>
-
-#include <Library/BaseLib.h>
-#include <Library/FileHandleLib.h>
-#include <Library/SerializeVariablesLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-/**
-  Loads the non-volatile variables from the NvVars file on the
-  given file system.
-
-  @param[in]  FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
-
-  @return     EFI_STATUS based on the success or failure of load operation
-
-**/
-EFI_STATUS
-LoadNvVarsFromFs (
-  EFI_HANDLE                            FsHandle
-  );
-
-
-/**
-  Saves the non-volatile variables into the NvVars file on the
-  given file system.
-
-  @param[in]  FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
-
-  @return     EFI_STATUS based on the success or failure of load operation
-
-**/
-EFI_STATUS
-SaveNvVarsToFs (
-  EFI_HANDLE                            FsHandle
-  );
-
-#endif
-
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.inf 
b/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
deleted file mode 100644
index 4731e77865..0000000000
--- a/Platform/Intel/SimicsOpenBoardPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-## @file
-#  NvVarsFileLib
-#
-#  This library saves and restores non-volatile variables in a
-#  file within a file system.
-#
-# Copyright (c) 2006 - 2019 Intel Corporation. All rights reserved. <BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = NvVarsFileLib
-  FILE_GUID                      = 8ECD4CC0-1772-4583-8A74-83633A15FAA0
-  MODULE_TYPE                    = UEFI_DRIVER
-  VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = NvVarsFileLib|DXE_DRIVER DXE_RUNTIME_DRIVER 
UEFI_DRIVER
-
-#
-# The following information is for reference only and not required by the 
build tools.
-#
-#  VALID_ARCHITECTURES           = IA32 X64 EBC
-#
-
-[Sources]
-  FsAccess.c
-  NvVarsFileLib.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  ShellPkg/ShellPkg.dec
-  OvmfPkg/OvmfPkg.dec
-
-[LibraryClasses]
-  BaseLib
-  BaseMemoryLib
-  DebugLib
-  FileHandleLib
-  MemoryAllocationLib
-  SerializeVariablesLib
-
-[Protocols]
-  gEfiSimpleFileSystemProtocolGuid              ## CONSUMES
-
-[Guids]
-  gEfiFileInfoGuid
-
-[Depex]
-  gEfiVariableWriteArchProtocolGuid
-
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
 
b/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
deleted file mode 100644
index be619c838a..0000000000
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
+++ /dev/null
@@ -1,869 +0,0 @@
-/** @file
-  Serialize Variables Library implementation
-
-  Copyright (c) 2004 - 2019 Intel Corporation. All rights reserved. <BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include "SerializeVariablesLib.h"
-
-/**
-  Serialization format:
-
-  The SerializeVariablesLib interface does not specify a format
-  for the serialization of the variable data.  This library uses
-  a packed array of a non-uniformly sized data structure elements.
-
-  Each variable is stored (packed) as:
-    UINT32   VendorNameSize;  // Name size in bytes
-    CHAR16   VendorName[?];   // The variable unicode name including the
-                              // null terminating character.
-    EFI_GUID VendorGuid;      // The variable GUID
-    UINT32   DataSize;        // The size of variable data in bytes
-    UINT8    Data[?];         // The variable data
-
-**/
-
-
-/**
-  Unpacks the next variable from the buffer
-
-  @param[in]  Buffer - Buffer pointing to the next variable instance
-                On subsequent calls, the pointer should be incremented
-                by the returned SizeUsed value.
-  @param[in]  MaxSize - Max allowable size for the variable data
-                On subsequent calls, this should be decremented
-                by the returned SizeUsed value.
-  @param[out] Name - Variable name string (address in Buffer)
-  @param[out] NameSize - Size of Name in bytes
-  @param[out] Guid - GUID of variable (address in Buffer)
-  @param[out] Attributes - Attributes of variable
-  @param[out] Data - Buffer containing Data for variable (address in Buffer)
-  @param[out] DataSize - Size of Data in bytes
-  @param[out] SizeUsed - Total size used for this variable instance in Buffer
-
-  @return     EFI_STATUS based on the success or failure of the operation
-
-**/
-STATIC
-EFI_STATUS
-UnpackVariableFromBuffer (
-  IN  VOID     *Buffer,
-  IN  UINTN    MaxSize,
-  OUT CHAR16   **Name,
-  OUT UINT32   *NameSize,
-  OUT EFI_GUID **Guid,
-  OUT UINT32   *Attributes,
-  OUT UINT32   *DataSize,
-  OUT VOID     **Data,
-  OUT UINTN    *SizeUsed
-  )
-{
-  UINT8  *BytePtr;
-  UINTN  Offset;
-
-  BytePtr = (UINT8*)Buffer;
-  Offset = 0;
-
-  *NameSize = *(UINT32*) (BytePtr + Offset);
-  Offset = Offset + sizeof (UINT32);
-
-  if (Offset > MaxSize) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  *Name = (CHAR16*) (BytePtr + Offset);
-  Offset = Offset + *(UINT32*)BytePtr;
-  if (Offset > MaxSize) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  *Guid = (EFI_GUID*) (BytePtr + Offset);
-  Offset = Offset + sizeof (EFI_GUID);
-  if (Offset > MaxSize) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  *Attributes = *(UINT32*) (BytePtr + Offset);
-  Offset = Offset + sizeof (UINT32);
-  if (Offset > MaxSize) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  *DataSize = *(UINT32*) (BytePtr + Offset);
-  Offset = Offset + sizeof (UINT32);
-  if (Offset > MaxSize) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  *Data = (VOID*) (BytePtr + Offset);
-  Offset = Offset + *DataSize;
-  if (Offset > MaxSize) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  *SizeUsed = Offset;
-
-  return EFI_SUCCESS;
-}
-
-
-/**
-  Iterates through the variables in the buffer, and calls a callback
-  function for each variable found.
-
-  @param[in]  CallbackFunction - Function called for each variable instance
-  @param[in]  Context - Passed to each call of CallbackFunction
-  @param[in]  Buffer - Buffer containing serialized variables
-  @param[in]  MaxSize - Size of Buffer in bytes
-
-  @return     EFI_STATUS based on the success or failure of the operation
-
-**/
-STATIC
-EFI_STATUS
-IterateVariablesInBuffer (
-  IN VARIABLE_SERIALIZATION_ITERATION_CALLBACK  CallbackFunction,
-  IN VOID                                       *CallbackContext,
-  IN VOID                                       *Buffer,
-  IN UINTN                                      MaxSize
-  )
-{
-  RETURN_STATUS Status;
-  UINTN         TotalSizeUsed;
-  UINTN         SizeUsed;
-
-  CHAR16        *Name;
-  UINT32        NameSize;
-  CHAR16        *AlignedName;
-  UINT32        AlignedNameMaxSize;
-  EFI_GUID      *Guid;
-  UINT32        Attributes;
-  UINT32        DataSize;
-  VOID          *Data;
-
-  SizeUsed = 0;
-  AlignedName = NULL;
-  AlignedNameMaxSize = 0;
-  Name = NULL;
-  Guid = NULL;
-  Attributes = 0;
-  DataSize = 0;
-  Data = NULL;
-
-  for (
-    Status = EFI_SUCCESS, TotalSizeUsed = 0;
-    !EFI_ERROR (Status) && (TotalSizeUsed < MaxSize);
-    ) {
-    Status = UnpackVariableFromBuffer (
-               (VOID*) ((UINT8*) Buffer + TotalSizeUsed),
-               (MaxSize - TotalSizeUsed),
-               &Name,
-               &NameSize,
-               &Guid,
-               &Attributes,
-               &DataSize,
-               &Data,
-               &SizeUsed
-               );
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-
-    //
-    // We copy the name to a separately allocated buffer,
-    // to be sure it is 16-bit aligned.
-    //
-    if (NameSize > AlignedNameMaxSize) {
-      if (AlignedName != NULL) {
-        FreePool (AlignedName);
-      }
-      AlignedName = AllocatePool (NameSize);
-    }
-    if (AlignedName == NULL) {
-      return EFI_OUT_OF_RESOURCES;
-    }
-    CopyMem (AlignedName, Name, NameSize);
-
-    TotalSizeUsed = TotalSizeUsed + SizeUsed;
-
-    //
-    // Run the callback function
-    //
-    Status = (*CallbackFunction) (
-               CallbackContext,
-               AlignedName,
-               Guid,
-               Attributes,
-               DataSize,
-               Data
-               );
-
-  }
-
-  if (AlignedName != NULL) {
-    FreePool (AlignedName);
-  }
-
-  //
-  // Make sure the entire buffer was used, or else return an error
-  //
-  if (TotalSizeUsed != MaxSize) {
-    DEBUG ((
-      EFI_D_ERROR,
-      "Deserialize variables error: TotalSizeUsed(%Lu) != MaxSize(%Lu)\n",
-      (UINT64)TotalSizeUsed,
-      (UINT64)MaxSize
-      ));
-    return EFI_INVALID_PARAMETER;
-  }
-
-  return EFI_SUCCESS;
-}
-
-
-STATIC
-RETURN_STATUS
-EFIAPI
-IterateVariablesCallbackNop (
-  IN  VOID                         *Context,
-  IN  CHAR16                       *VariableName,
-  IN  EFI_GUID                     *VendorGuid,
-  IN  UINT32                       Attributes,
-  IN  UINTN                        DataSize,
-  IN  VOID                         *Data
-  )
-{
-  return RETURN_SUCCESS;
-}
-
-
-STATIC
-RETURN_STATUS
-EFIAPI
-IterateVariablesCallbackSetInInstance (
-  IN  VOID                         *Context,
-  IN  CHAR16                       *VariableName,
-  IN  EFI_GUID                     *VendorGuid,
-  IN  UINT32                       Attributes,
-  IN  UINTN                        DataSize,
-  IN  VOID                         *Data
-  )
-{
-  EFI_HANDLE  Instance;
-
-  Instance = (EFI_HANDLE) Context;
-
-  return SerializeVariablesAddVariable (
-           Instance,
-           VariableName,
-           VendorGuid,
-           Attributes,
-           DataSize,
-           Data
-           );
-}
-
-
-STATIC
-RETURN_STATUS
-EFIAPI
-IterateVariablesCallbackSetSystemVariable (
-  IN  VOID                         *Context,
-  IN  CHAR16                       *VariableName,
-  IN  EFI_GUID                     *VendorGuid,
-  IN  UINT32                       Attributes,
-  IN  UINTN                        DataSize,
-  IN  VOID                         *Data
-  )
-{
-  EFI_STATUS          Status;
-  STATIC CONST UINT32 AuthMask =
-                        EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS |
-                        EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
-
-  Status = gRT->SetVariable (
-             VariableName,
-             VendorGuid,
-             Attributes,
-             DataSize,
-             Data
-             );
-
-  if (Status == EFI_SECURITY_VIOLATION && (Attributes & AuthMask) != 0) {
-    DEBUG ((DEBUG_WARN, "%a: setting authenticated variable \"%s\" "
-            "failed with EFI_SECURITY_VIOLATION, ignoring\n", __FUNCTION__,
-            VariableName));
-    Status = EFI_SUCCESS;
-  } else if (Status == EFI_WRITE_PROTECTED) {
-    DEBUG ((DEBUG_WARN, "%a: setting ReadOnly variable \"%s\" "
-            "failed with EFI_WRITE_PROTECTED, ignoring\n", __FUNCTION__,
-            VariableName));
-    Status = EFI_SUCCESS;
-  }
-  return Status;
-}
-
-
-STATIC
-RETURN_STATUS
-EnsureExtraBufferSpace (
-  IN  SV_INSTANCE  *Instance,
-  IN  UINTN        Size
-  )
-{
-  VOID *NewBuffer;
-  UINTN NewSize;
-
-  NewSize = Instance->DataSize + Size;
-  if (NewSize <= Instance->BufferSize) {
-    return RETURN_SUCCESS;
-  }
-
-  //
-  // Double the required size to lessen the need to re-allocate in the future
-  //
-  NewSize = 2 * NewSize;
-
-  NewBuffer = AllocatePool (NewSize);
-  if (NewBuffer == NULL) {
-    return RETURN_OUT_OF_RESOURCES;
-  }
-
-  if (Instance->BufferPtr != NULL) {
-    CopyMem (NewBuffer, Instance->BufferPtr, Instance->DataSize);
-    FreePool (Instance->BufferPtr);
-  }
-
-  Instance->BufferPtr = NewBuffer;
-  Instance->BufferSize = NewSize;
-
-  return RETURN_SUCCESS;
-}
-
-
-STATIC
-VOID
-AppendToBuffer (
-  IN  SV_INSTANCE  *Instance,
-  IN  VOID         *Data,
-  IN  UINTN        Size
-  )
-{
-  UINTN NewSize;
-
-  ASSERT (Instance != NULL);
-  ASSERT (Data != NULL);
-
-  NewSize = Instance->DataSize + Size;
-  ASSERT ((Instance->DataSize + Size) <= Instance->BufferSize);
-
-  CopyMem (
-    (VOID*) (((UINT8*) (Instance->BufferPtr)) + Instance->DataSize),
-    Data,
-    Size
-    );
-
-  Instance->DataSize = NewSize;
-}
-
-
-/**
-  Creates a new variable serialization instance
-
-  @param[out]  Handle - Handle for a variable serialization instance
-
-  @retval      RETURN_SUCCESS - The variable serialization instance was
-                 successfully created.
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 create the variable serialization instance.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesNewInstance (
-  OUT EFI_HANDLE                      *Handle
-  )
-{
-  SV_INSTANCE  *New;
-
-  New = AllocateZeroPool (sizeof (*New));
-  if (New == NULL) {
-    return RETURN_OUT_OF_RESOURCES;
-  }
-
-  New->Signature = SV_SIGNATURE;
-
-  *Handle = (EFI_HANDLE) New;
-  return RETURN_SUCCESS;
-}
-
-
-/**
-  Free memory associated with a variable serialization instance
-
-  @param[in]  Handle - Handle for a variable serialization instance
-
-  @retval      RETURN_SUCCESS - The variable serialization instance was
-                 successfully freed.
-  @retval      RETURN_INVALID_PARAMETER - Handle was not a valid
-                 variable serialization instance.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesFreeInstance (
-  IN EFI_HANDLE Handle
-  )
-{
-  SV_INSTANCE    *Instance;
-
-  Instance = SV_FROM_HANDLE (Handle);
-
-  if (Instance->Signature != SV_SIGNATURE) {
-    return RETURN_INVALID_PARAMETER;
-  }
-
-  Instance->Signature = 0;
-
-  if (Instance->BufferPtr != NULL) {
-    FreePool (Instance->BufferPtr);
-  }
-
-  FreePool (Instance);
-
-  return RETURN_SUCCESS;
-}
-
-
-/**
-  Creates a new variable serialization instance using the given
-  binary representation of the variables to fill the new instance
-
-  @param[out] Handle - Handle for a variable serialization instance
-  @param[in]  Buffer - A buffer with the serialized representation
-                of the variables.  Must be the same format as produced
-                by SerializeVariablesToBuffer.
-  @param[in]  Size - This is the size of the binary representation
-                of the variables.
-
-  @retval      RETURN_SUCCESS - The binary representation was successfully
-                 imported into a new variable serialization instance
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 create the new variable serialization instance
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesNewInstanceFromBuffer (
-  OUT EFI_HANDLE                          *Handle,
-  IN  VOID                                *Buffer,
-  IN  UINTN                               Size
-  )
-{
-  RETURN_STATUS Status;
-
-  Status = SerializeVariablesNewInstance (Handle);
-  if (RETURN_ERROR (Status)) {
-    return Status;
-  }
-
-  Status = IterateVariablesInBuffer (
-             IterateVariablesCallbackNop,
-             NULL,
-             Buffer,
-             Size
-             );
-  if (RETURN_ERROR (Status)) {
-    SerializeVariablesFreeInstance (*Handle);
-    return Status;
-  }
-
-  Status = IterateVariablesInBuffer (
-             IterateVariablesCallbackSetInInstance,
-             (VOID*) *Handle,
-             Buffer,
-             Size
-             );
-  if (RETURN_ERROR (Status)) {
-    SerializeVariablesFreeInstance (*Handle);
-    return Status;
-  }
-
-  return Status;
-}
-
-
-/**
-  Iterates all variables found with RuntimeServices GetNextVariableName
-
-  @param[in]   CallbackFunction - Function called for each variable instance
-  @param[in]   Context - Passed to each call of CallbackFunction
-
-  @retval      RETURN_SUCCESS - All variables were iterated without the
-                 CallbackFunction returning an error
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 iterate through the variables
-  @return      Any of RETURN_ERROR indicates an error reading the variable
-                 or an error was returned from CallbackFunction
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesIterateSystemVariables (
-  IN VARIABLE_SERIALIZATION_ITERATION_CALLBACK CallbackFunction,
-  IN VOID                                      *Context
-  )
-{
-  RETURN_STATUS               Status;
-  UINTN                       VariableNameBufferSize;
-  UINTN                       VariableNameSize;
-  CHAR16                      *VariableName;
-  EFI_GUID                    VendorGuid;
-  UINTN                       VariableDataBufferSize;
-  UINTN                       VariableDataSize;
-  VOID                        *VariableData;
-  UINT32                      VariableAttributes;
-  VOID                        *NewBuffer;
-
-  //
-  // Initialize the variable name and data buffer variables.
-  //
-  VariableNameBufferSize = sizeof (CHAR16);
-  VariableName = AllocateZeroPool (VariableNameBufferSize);
-
-  VariableDataBufferSize = 0;
-  VariableData = NULL;
-
-  for (;;) {
-    //
-    // Get the next variable name and guid
-    //
-    VariableNameSize = VariableNameBufferSize;
-    Status = gRT->GetNextVariableName (
-                    &VariableNameSize,
-                    VariableName,
-                    &VendorGuid
-                    );
-    if (Status == EFI_BUFFER_TOO_SMALL) {
-      //
-      // The currently allocated VariableName buffer is too small,
-      // so we allocate a larger buffer, and copy the old buffer
-      // to it.
-      //
-      NewBuffer = AllocatePool (VariableNameSize);
-      if (NewBuffer == NULL) {
-        Status = EFI_OUT_OF_RESOURCES;
-        break;
-      }
-      CopyMem (NewBuffer, VariableName, VariableNameBufferSize);
-      if (VariableName != NULL) {
-        FreePool (VariableName);
-      }
-      VariableName = NewBuffer;
-      VariableNameBufferSize = VariableNameSize;
-
-      //
-      // Try to get the next variable name again with the larger buffer.
-      //
-      Status = gRT->GetNextVariableName (
-                      &VariableNameSize,
-                      VariableName,
-                      &VendorGuid
-                      );
-    }
-
-    if (EFI_ERROR (Status)) {
-      if (Status == EFI_NOT_FOUND) {
-        Status = EFI_SUCCESS;
-      }
-      break;
-    }
-
-    //
-    // Get the variable data and attributes
-    //
-    VariableDataSize = VariableDataBufferSize;
-    Status = gRT->GetVariable (
-                    VariableName,
-                    &VendorGuid,
-                    &VariableAttributes,
-                    &VariableDataSize,
-                    VariableData
-                    );
-    if (Status == EFI_BUFFER_TOO_SMALL) {
-      //
-      // The currently allocated VariableData buffer is too small,
-      // so we allocate a larger buffer.
-      //
-      if (VariableDataBufferSize != 0) {
-        FreePool (VariableData);
-        VariableData = NULL;
-        VariableDataBufferSize = 0;
-      }
-      VariableData = AllocatePool (VariableDataSize);
-      if (VariableData == NULL) {
-        Status = EFI_OUT_OF_RESOURCES;
-        break;
-      }
-      VariableDataBufferSize = VariableDataSize;
-
-      //
-      // Try to read the variable again with the larger buffer.
-      //
-      Status = gRT->GetVariable (
-                      VariableName,
-                      &VendorGuid,
-                      &VariableAttributes,
-                      &VariableDataSize,
-                      VariableData
-                      );
-    }
-    if (EFI_ERROR (Status)) {
-      break;
-    }
-
-    //
-    // Run the callback function
-    //
-    Status = (*CallbackFunction) (
-               Context,
-               VariableName,
-               &VendorGuid,
-               VariableAttributes,
-               VariableDataSize,
-               VariableData
-               );
-    if (EFI_ERROR (Status)) {
-      break;
-    }
-
-  }
-
-  if (VariableName != NULL) {
-    FreePool (VariableName);
-  }
-
-  if (VariableData != NULL) {
-    FreePool (VariableData);
-  }
-
-  return Status;
-}
-
-
-/**
-  Iterates all variables found in the variable serialization instance
-
-  @param[in]   Handle - Handle for a variable serialization instance
-  @param[in]   CallbackFunction - Function called for each variable instance
-  @param[in]   Context - Passed to each call of CallbackFunction
-
-  @retval      RETURN_SUCCESS - All variables were iterated without the
-                 CallbackFunction returning an error
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 iterate through the variables
-  @return      Any of RETURN_ERROR indicates an error reading the variable
-                 or an error was returned from CallbackFunction
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesIterateInstanceVariables (
-  IN EFI_HANDLE                                Handle,
-  IN VARIABLE_SERIALIZATION_ITERATION_CALLBACK CallbackFunction,
-  IN VOID                                      *Context
-  )
-{
-  SV_INSTANCE    *Instance;
-
-  Instance = SV_FROM_HANDLE (Handle);
-
-  if ((Instance->BufferPtr != NULL) && (Instance->DataSize != 0)) {
-    return IterateVariablesInBuffer (
-             CallbackFunction,
-             Context,
-             Instance->BufferPtr,
-             Instance->DataSize
-             );
-  } else {
-    return RETURN_SUCCESS;
-  }
-}
-
-
-/**
-  Sets all variables found in the variable serialization instance
-
-  @param[in]   Handle - Handle for a variable serialization instance
-
-  @retval      RETURN_SUCCESS - All variables were set successfully
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 set all the variables
-  @return      Any of RETURN_ERROR indicates an error reading the variables
-                 or in attempting to set a variable
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesSetSerializedVariables (
-  IN EFI_HANDLE                       Handle
-  )
-{
-  return SerializeVariablesIterateInstanceVariables (
-           Handle,
-           IterateVariablesCallbackSetSystemVariable,
-           NULL
-           );
-}
-
-
-/**
-  Adds a variable to the variable serialization instance
-
-  @param[in] Handle - Handle for a variable serialization instance
-  @param[in] VariableName - Refer to RuntimeServices GetVariable
-  @param[in] VendorGuid - Refer to RuntimeServices GetVariable
-  @param[in] Attributes - Refer to RuntimeServices GetVariable
-  @param[in] DataSize - Refer to RuntimeServices GetVariable
-  @param[in] Data - Refer to RuntimeServices GetVariable
-
-  @retval      RETURN_SUCCESS - All variables were set successfully
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 add the variable
-  @retval      RETURN_INVALID_PARAMETER - Handle was not a valid
-                 variable serialization instance or
-                 VariableName, VariableGuid or Data are NULL.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesAddVariable (
-  IN EFI_HANDLE                   Handle,
-  IN CHAR16                       *VariableName,
-  IN EFI_GUID                     *VendorGuid,
-  IN UINT32                       Attributes,
-  IN UINTN                        DataSize,
-  IN VOID                         *Data
-  )
-{
-  RETURN_STATUS  Status;
-  SV_INSTANCE    *Instance;
-  UINT32         SerializedNameSize;
-  UINT32         SerializedDataSize;
-  UINTN          SerializedSize;
-
-  Instance = SV_FROM_HANDLE (Handle);
-
-  if ((Instance->Signature != SV_SIGNATURE) ||
-      (VariableName == NULL) || (VendorGuid == NULL) || (Data == NULL)) {
-  }
-
-  SerializedNameSize = (UINT32) StrSize (VariableName);
-
-  SerializedSize =
-    sizeof (SerializedNameSize) +
-    SerializedNameSize +
-    sizeof (*VendorGuid) +
-    sizeof (Attributes) +
-    sizeof (SerializedDataSize) +
-    DataSize;
-
-  Status = EnsureExtraBufferSpace (
-             Instance,
-             SerializedSize
-             );
-  if (RETURN_ERROR (Status)) {
-    return Status;
-  }
-
-  //
-  // Add name size (UINT32)
-  //
-  AppendToBuffer (Instance, (VOID*) &SerializedNameSize, sizeof 
(SerializedNameSize));
-
-  //
-  // Add variable unicode name string
-  //
-  AppendToBuffer (Instance, (VOID*) VariableName, SerializedNameSize);
-
-  //
-  // Add variable GUID
-  //
-  AppendToBuffer (Instance, (VOID*) VendorGuid, sizeof (*VendorGuid));
-
-  //
-  // Add variable attributes
-  //
-  AppendToBuffer (Instance, (VOID*) &Attributes, sizeof (Attributes));
-
-  //
-  // Add variable data size (UINT32)
-  //
-  SerializedDataSize = (UINT32) DataSize;
-  AppendToBuffer (Instance, (VOID*) &SerializedDataSize, sizeof 
(SerializedDataSize));
-
-  //
-  // Add variable data
-  //
-  AppendToBuffer (Instance, Data, DataSize);
-
-  return RETURN_SUCCESS;
-}
-
-
-/**
-  Serializes the variables known to this instance into the
-  provided buffer.
-
-  @param[in]     Handle - Handle for a variable serialization instance
-  @param[out]    Buffer - A buffer to store the binary representation
-                   of the variables.
-  @param[in,out] Size - On input this is the size of the buffer.
-                   On output this is the size of the binary representation
-                   of the variables.
-
-  @retval      RETURN_SUCCESS - The binary representation was successfully
-                 completed and returned in the buffer.
-  @retval      RETURN_OUT_OF_RESOURCES - There we not enough resources to
-                 save the variables to the buffer.
-  @retval      RETURN_INVALID_PARAMETER - Handle was not a valid
-                 variable serialization instance or
-                 Size or Buffer were NULL.
-  @retval      RETURN_BUFFER_TOO_SMALL - The Buffer size as indicated by
-                 the Size parameter was too small for the serialized
-                 variable data.  Size is returned with the required size.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerializeVariablesToBuffer (
-  IN     EFI_HANDLE                       Handle,
-  OUT    VOID                             *Buffer,
-  IN OUT UINTN                            *Size
-  )
-{
-  SV_INSTANCE    *Instance;
-
-  Instance = SV_FROM_HANDLE (Handle);
-
-  if (Size == NULL) {
-    return RETURN_INVALID_PARAMETER;
-  }
-
-  if (*Size < Instance->DataSize) {
-    *Size = Instance->DataSize;
-    return RETURN_BUFFER_TOO_SMALL;
-  }
-
-  if (Buffer == NULL) {
-    return RETURN_INVALID_PARAMETER;
-  }
-
-  *Size = Instance->DataSize;
-  CopyMem (Buffer, Instance->BufferPtr, Instance->DataSize);
-
-  return RETURN_SUCCESS;
-}
-
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.h
 
b/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.h
deleted file mode 100644
index 9b4c2a629a..0000000000
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/** @file
-  Serialize Variables Library implementation
-
-  Copyright (c) 2009 - 2019 Intel Corporation. All rights reserved. <BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef __SERIALIZE_VARIABLES_LIB_INSTANCE__
-#define __SERIALIZE_VARIABLES_LIB_INSTANCE__
-
-#include <Uefi.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/SerializeVariablesLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-
-#define SV_FROM_HANDLE(a)       CR (a, SV_INSTANCE, Signature, SV_SIGNATURE)
-#define SV_SIGNATURE            SIGNATURE_32 ('S', 'V', 'A', 'R')
-
-typedef struct {
-  UINT32                              Signature;
-  VOID                                *BufferPtr;
-  UINTN                               BufferSize;
-  UINTN                               DataSize;
-} SV_INSTANCE;
-
-#endif
-
diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
 
b/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
deleted file mode 100644
index 08c561f586..0000000000
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
+++ /dev/null
@@ -1,36 +0,0 @@
-## @file
-#  Serialize Variables Library implementation
-#
-#  This library serializes and deserializes UEFI variables
-#
-# Copyright (c) 2006 - 2019 Intel Corporation. All rights reserved. <BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = DxeSerializeVariablesLib
-  FILE_GUID                      = 266A1434-6B22-441F-A8D2-D54AA8FDF95C
-  MODULE_TYPE                    = UEFI_DRIVER
-  VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = SerializeVariablesLib|DXE_DRIVER 
DXE_RUNTIME_DRIVER UEFI_DRIVER
-
-[Sources]
-  SerializeVariablesLib.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  ShellPkg/ShellPkg.dec
-  SimicsOpenBoardPkg/OpenBoardPkg.dec
-
-[LibraryClasses]
-  BaseLib
-  BaseMemoryLib
-  DebugLib
-  MemoryAllocationLib
-  UefiBootServicesTableLib
-  UefiRuntimeServicesTableLib
-
diff --git a/Platform/Intel/SimicsOpenBoardPkg/OpenBoardPkg.dec 
b/Platform/Intel/SimicsOpenBoardPkg/OpenBoardPkg.dec
index e8aefdd893..c4e24f1e0c 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/OpenBoardPkg.dec
+++ b/Platform/Intel/SimicsOpenBoardPkg/OpenBoardPkg.dec
@@ -48,9 +48,6 @@
 
 [PcdsDynamic, PcdsDynamicEx]
 
-  # TODO: investigate whether next two Pcds are needed
-  gSimicsOpenBoardPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|0x28
-  
gSimicsOpenBoardPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10
   
gSimicsOpenBoardPkgTokenSpaceGuid.PcdSimicsX58HostBridgePciDevId|0|UINT16|0x1b
 
   ## The IO port aperture shared by all PCI root bridges.
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105231): https://edk2.groups.io/g/devel/message/105231
Mute This Topic: https://groups.io/mt/99107257/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to