Home | History | Annotate | Download | only in PlatformPei
      1 /*++
      2 
      3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
      4 
      5   This program and the accompanying materials are licensed and made available under
      7   the terms and conditions of the BSD License that accompanies this distribution.
      9   The full text of the license may be found at
     11   http://opensource.org/licenses/bsd-license.php.
     13 
     15   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     17   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     19 
     21 
     23 
     24 **/
     25 
     26 
     27 #ifndef __PEI_PLATFORM_H__
     28 #define __PEI_PLATFORM_H__
     29 
     30 #define PEI_STALL_RESOLUTION            1
     31 #define STALL_PEIM_SIGNATURE   SIGNATURE_32('p','p','u','s')
     32 
     33 typedef struct {
     34   UINT32                      Signature;
     35   EFI_FFS_FILE_HEADER         *FfsHeader;
     36   EFI_PEI_NOTIFY_DESCRIPTOR   StallNotify;
     37 } STALL_CALLBACK_STATE_INFORMATION;
     38 
     39 #define STALL_PEIM_FROM_THIS(a) CR (a, STALL_CALLBACK_STATE_INFORMATION, StallNotify, STALL_PEIM_SIGNATURE)
     40 
     41 #ifdef NOCS_S3_SUPPORT
     42 
     43 /**
     44   Peform the boot mode determination logic
     45   If the box is closed, then
     46   1. If it's first time to boot, it's boot with full config .
     47   2. If the ChassisIntrution is selected, force to be a boot with full config
     48   3. Otherwise it's boot with no change.
     49 
     50   @param  PeiServices General purpose services available to every PEIM.
     51   @param  BootMode The detected boot mode.
     52 
     53   @retval EFI_SUCCESS if the boot mode could be set
     54 **/
     55 EFI_STATUS
     56 UpdateBootMode (
     57   IN CONST EFI_PEI_SERVICES     **PeiServices
     58   );
     59 #endif
     60 
     61 /**
     62   This function reset the entire platform, including all processor and devices, and
     63   reboots the system.
     64 
     65   @param  PeiServices General purpose services available to every PEIM.
     66 
     67   @retval EFI_SUCCESS if it completed successfully.
     68 **/
     69 EFI_STATUS
     70 EFIAPI
     71 ResetSystem (
     72   IN CONST EFI_PEI_SERVICES          **PeiServices
     73   );
     74 
     75 /**
     76   This function will be called when MRC is done.
     77 
     78   @param  PeiServices        General purpose services available to every PEIM.
     79   @param  NotifyDescriptor   Information about the notify event..
     80   @param  Ppi                The notify context.
     81 
     82   @retval EFI_SUCCESS        If the function completed successfully.
     83 **/
     84 EFI_STATUS
     85 EFIAPI
     86 MemoryDiscoveredPpiNotifyCallback (
     87   IN EFI_PEI_SERVICES                     **PeiServices,
     88   IN EFI_PEI_NOTIFY_DESCRIPTOR            *NotifyDescriptor,
     89   IN VOID                                 *Ppi
     90   );
     91 
     92 /**
     93   This is the callback function notified by FvFileLoader PPI, it depends on FvFileLoader PPI to load
     94   the PEIM into memory.
     95 
     96   @param  PeiServices       General purpose services available to every PEIM.
     97   @param  NotifyDescriptor  The context of notification.
     98   @param  Ppi               The notify PPI.
     99 
    100   @retval EFI_SUCCESS       if it completed successfully.
    101 **/
    102 EFI_STATUS
    103 EFIAPI
    104 FvFileLoaderPpiNotifyCallback (
    105   IN EFI_PEI_SERVICES           **PeiServices,
    106   IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
    107   IN VOID                       *Ppi
    108   );
    109 
    110 /**
    111   This function provides a blocking stall for reset at least the given number of microseconds
    112   stipulated in the final argument.
    113 
    114   @param  PeiServices    General purpose services available to every PEIM.
    115   @param  this Pointer   to the local data for the interface.
    116   @param  Microseconds   number of microseconds for which to stall.
    117 
    118   @retval EFI_SUCCESS    the function provided at least the required stall.
    119 **/
    120 EFI_STATUS
    121 EFIAPI
    122 Stall (
    123   IN CONST EFI_PEI_SERVICES   **PeiServices,
    124   IN CONST EFI_PEI_STALL_PPI  *This,
    125   IN UINTN                    Microseconds
    126   );
    127 
    128 /**
    129   This function initialize recovery functionality by installing the recovery PPI.
    130 
    131   @param  PeiServices  General purpose services available to every PEIM.
    132 
    133   @retval EFI_SUCCESS  If the interface could be successfully installed.
    134 **/
    135 EFI_STATUS
    136 EFIAPI
    137 InitializeRecovery (
    138   IN EFI_PEI_SERVICES     **PeiServices
    139   );
    140 
    141 /**
    142   This function
    143     1. Calling MRC to initialize memory.
    144     2. Install EFI Memory.
    145     3. Capsule coalesce if capsule boot mode.
    146     4. Create HOB of system memory.
    147 
    148   @param  PeiServices Pointer to the PEI Service Table
    149 
    150   @retval EFI_SUCCESS If it completes successfully.
    151 
    152 **/
    153 EFI_STATUS
    154 MemoryInit (
    155   IN EFI_PEI_SERVICES          **PeiServices
    156   );
    157 
    158 /**
    159   This function provides the implementation of AtaController PPI Enable Channel function.
    160 
    161   @param  PeiServices General purpose services available to every PEIM.
    162   @param  this Pointer to the local data for the interface.
    163   @param  ChannelMask This parameter is used to specify primary or slavery IDE channel.
    164 
    165   @retval EFI_SUCCESS  Procedure returned successfully.
    166 **/
    167 EFI_STATUS
    168 EnableAtaChannel (
    169   IN EFI_PEI_SERVICES               **PeiServices,
    170   IN PEI_ATA_CONTROLLER_PPI         *This,
    171   IN UINT8                          ChannelMask
    172   );
    173 
    174 /**
    175   This function provides the implementation of AtaController PPI Get IDE channel Register Base Address
    176 
    177   @param  PeiServices      General purpose services available to every PEIM.
    178   @param  this             Pointer to the local data for the interface.
    179   @param  IdeRegsBaseAddr  Pointer to IDE_REGS_BASE_ADDR struct, which is used to record
    180                            IDE Command and Control regeisters Base Address.
    181 
    182   @retval EFI_SUCCESS  Procedure returned successfully.
    183 **/
    184 EFI_STATUS
    185 GetIdeRegsBaseAddr (
    186   IN EFI_PEI_SERVICES               **PeiServices,
    187   IN PEI_ATA_CONTROLLER_PPI         *This,
    188   IN IDE_REGS_BASE_ADDR             *IdeRegsBaseAddr
    189   );
    190 
    191 /**
    192   This function provides the implementation to properly setup both LM & PDM functionality.
    193 
    194   @param  PeiServices      General purpose services available to every PEIM.
    195 
    196   @retval EFI_SUCCESS  Procedure returned successfully.
    197 
    198 **/
    199 EFI_STATUS
    200 ConfigureLM(
    201   IN EFI_PEI_SERVICES **PeiServices
    202   );
    203 
    204 #include <Ppi/VlvMmioPolicy.h>
    205 
    206 BOOLEAN
    207 EFIAPI
    208 IsFastBootEnabled (
    209   IN CONST EFI_PEI_SERVICES **PeiServices
    210   );
    211 
    212 EFI_STATUS
    213 PrioritizeBootMode (
    214   IN OUT EFI_BOOT_MODE    *CurrentBootMode,
    215   IN EFI_BOOT_MODE        NewBootMode
    216   );
    217 
    218 EFI_STATUS
    219 EFIAPI
    220 CapsulePpiNotifyCallback (
    221   IN EFI_PEI_SERVICES           **PeiServices,
    222   IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
    223   IN VOID                       *Ppi
    224   );
    225 #endif
    226