]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLibDxe.c
Vlv2TbltDevicePkg/FlashDeviceLib: Add DXE flash device lib.
[mirror_edk2.git] / Vlv2TbltDevicePkg / Library / FlashDeviceLib / FlashDeviceLibDxe.c
diff --git a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLibDxe.c b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLibDxe.c
new file mode 100644 (file)
index 0000000..1601099
--- /dev/null
@@ -0,0 +1,62 @@
+/** @file\r
+\r
+  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  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
+**/\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Library/FlashDeviceLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include "SpiChipDefinitions.h"\r
+\r
+extern UINTN FlashDeviceBase;\r
+\r
+extern EFI_SPI_PROTOCOL *mSpiProtocol;\r
+\r
+/**\r
+  The library constructuor.\r
+\r
+  The function does the necessary initialization work for this library\r
+  instance. Please put all initialization works in it.\r
+\r
+  @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.\r
+  @param[in]  SystemTable       A pointer to the EFI system table.\r
+\r
+  @retval     EFI_SUCCESS       The function always return EFI_SUCCESS for now.\r
+                                It will ASSERT on error for debug version.\r
+  @retval     EFI_ERROR         Please reference LocateProtocol for error code details.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LibFvbFlashDeviceSupportInit (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS Status;\r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiSpiProtocolGuid,\r
+                  NULL,\r
+                  (VOID **)&mSpiProtocol\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+  // There is no need to call Init, because Runtime or SMM FVB already does that.\r
+  DEBUG((EFI_D_ERROR, "LibFvbFlashDeviceSupportInit - no init\n"));\r
+  return EFI_SUCCESS;\r
+}\r
+\r