Home | History | Annotate | Download | only in FlashDeviceLib
      1 /** @file
      2 
      3   Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>
      4 
      5   This program and the accompanying materials are licensed and made available under
      6   the terms and conditions of the BSD License that accompanies this distribution.
      7   The full text of the license may be found at
      8   http://opensource.org/licenses/bsd-license.php.
      9 
     10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 
     14 
     15 **/
     16 
     17 #include <PiDxe.h>
     18 
     19 #include <Library/FlashDeviceLib.h>
     20 #include <Library/DebugLib.h>
     21 #include <Library/BaseLib.h>
     22 #include <Library/UefiBootServicesTableLib.h>
     23 #include <Library/BaseMemoryLib.h>
     24 #include "SpiChipDefinitions.h"
     25 
     26 extern UINTN FlashDeviceBase;
     27 
     28 extern EFI_SPI_PROTOCOL *mSpiProtocol;
     29 
     30 /**
     31   The library constructuor.
     32 
     33   The function does the necessary initialization work for this library
     34   instance. Please put all initialization works in it.
     35 
     36   @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.
     37   @param[in]  SystemTable       A pointer to the EFI system table.
     38 
     39   @retval     EFI_SUCCESS       The function always return EFI_SUCCESS for now.
     40                                 It will ASSERT on error for debug version.
     41   @retval     EFI_ERROR         Please reference LocateProtocol for error code details.
     42 
     43 **/
     44 EFI_STATUS
     45 EFIAPI
     46 LibFvbFlashDeviceSupportInit (
     47   IN EFI_HANDLE         ImageHandle,
     48   IN EFI_SYSTEM_TABLE   *SystemTable
     49   )
     50 {
     51   EFI_STATUS Status;
     52   Status = gBS->LocateProtocol (
     53                   &gEfiSpiProtocolGuid,
     54                   NULL,
     55                   (VOID **)&mSpiProtocol
     56                   );
     57   ASSERT_EFI_ERROR (Status);
     58   // There is no need to call Init, because Runtime or SMM FVB already does that.
     59   DEBUG((EFI_D_ERROR, "LibFvbFlashDeviceSupportInit - no init\n"));
     60   return EFI_SUCCESS;
     61 }
     62 
     63