Home | History | Annotate | Download | only in FspInitPei
      1 /** @file
      2   This PEIM initialize FSP.
      3 
      4   Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
      5   This program and the accompanying materials
      6   are licensed and made available under the terms and conditions of the BSD License
      7   which accompanies this distribution.  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 #include "FspInitPei.h"
     17 
     18 /**
     19   This is the entrypoint of PEIM
     20 
     21   @param[in] FileHandle  Handle of the file being invoked.
     22   @param[in] PeiServices Describes the list of possible PEI Services.
     23 
     24   @retval EFI_SUCCESS if it completed successfully.
     25 **/
     26 EFI_STATUS
     27 EFIAPI
     28 FspPeiEntryPoint (
     29   IN       EFI_PEI_FILE_HANDLE  FileHandle,
     30   IN CONST EFI_PEI_SERVICES     **PeiServices
     31   )
     32 {
     33   FSP_INFO_HEADER      *FspHeader;
     34   UINT8                PcdFspApiVersion;
     35 
     36   DEBUG ((DEBUG_INFO, "FspPeiEntryPoint\n"));
     37   PcdFspApiVersion = 1;
     38 
     39   FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
     40   DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", FspHeader));
     41   if (FspHeader == NULL) {
     42     return EFI_DEVICE_ERROR;
     43   }
     44 
     45   ASSERT (FspHeader->TempRamInitEntryOffset != 0);
     46   ASSERT (FspHeader->FspInitEntryOffset != 0);
     47   ASSERT (FspHeader->NotifyPhaseEntryOffset != 0);
     48 
     49   if ((PcdGet8 (PcdFspApiVersion) >= 2) &&
     50       (FspHeader->HeaderRevision >= FSP_HEADER_REVISION_2) &&
     51       (FspHeader->ApiEntryNum >= 6) ) {
     52     ASSERT (FspHeader->FspMemoryInitEntryOffset != 0);
     53     ASSERT (FspHeader->TempRamExitEntryOffset != 0);
     54     ASSERT (FspHeader->FspSiliconInitEntryOffset != 0);
     55     PcdFspApiVersion = PcdGet8 (PcdFspApiVersion);
     56   }
     57   DEBUG ((DEBUG_INFO, "PcdFspApiVersion - 0x%x\n", PcdFspApiVersion));
     58 
     59   if (PcdFspApiVersion == 1) {
     60     PeiFspInitV1 (FspHeader);
     61   } else {
     62     PeiFspInitV2 (FspHeader);
     63   }
     64 
     65   return EFI_SUCCESS;
     66 }
     67