Home | History | Annotate | Download | only in Ppi
      1 /** @file
      2   Defines the APIs that enable PEI services to work with
      3   the underlying capsule capabilities of the platform.
      4 
      5 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
      6 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.
      8 The full text of the license may be found at
      9 http://opensource.org/licenses/bsd-license.php.
     10 
     11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14   @par Revision Reference:
     15   This PPI is introduced in PI Version 1.4.
     16 
     17 **/
     18 
     19 #ifndef _PEI_CAPSULE_PPI_H_
     20 #define _PEI_CAPSULE_PPI_H_
     21 
     22 ///
     23 /// Global ID for the EFI_PEI_CAPSULE_PPI.
     24 ///
     25 #define EFI_PEI_CAPSULE_PPI_GUID \
     26   { \
     27     0x3acf33ee, 0xd892, 0x40f4, {0xa2, 0xfc, 0x38, 0x54, 0xd2, 0xe1, 0x32, 0x3d } \
     28   }
     29 
     30 ///
     31 /// Forward declaration for the EFI_PEI_CAPSULE_PPI.
     32 ///
     33 typedef struct _EFI_PEI_CAPSULE_PPI EFI_PEI_CAPSULE_PPI;
     34 
     35 ///
     36 /// Keep name backwards compatible before PI Version 1.4
     37 ///
     38 typedef struct _EFI_PEI_CAPSULE_PPI PEI_CAPSULE_PPI;
     39 
     40 /**
     41   Upon determining that there is a capsule to operate on, this service
     42   will use a series of EFI_CAPSULE_BLOCK_DESCRIPTOR entries to determine
     43   the current location of the various capsule fragments and coalesce them
     44   into a contiguous region of system memory.
     45 
     46   @param[in]  PeiServices   Pointer to the PEI Services Table.
     47   @param[out] MemoryBase    Pointer to the base of a block of memory into which the buffers will be coalesced.
     48                             On output, this variable will hold the base address
     49                             of a coalesced capsule.
     50   @param[out] MemorySize    Size of the memory region pointed to by MemoryBase.
     51                             On output, this variable will contain the size of the
     52                             coalesced capsule.
     53 
     54   @retval EFI_NOT_FOUND          If: boot modecould not be determined, or the
     55                                  boot mode is not flash-update, or the capsule descriptors were not found.
     56   @retval EFI_BUFFER_TOO_SMALL   The capsule could not be coalesced in the provided memory region.
     57   @retval EFI_SUCCESS            There was no capsule, or the capsule was processed successfully.
     58 
     59 **/
     60 typedef
     61 EFI_STATUS
     62 (EFIAPI *EFI_PEI_CAPSULE_COALESCE)(
     63   IN EFI_PEI_SERVICES  **PeiServices,
     64   IN OUT VOID          **MemoryBase,
     65   IN OUT UINTN         *MemSize
     66   );
     67 
     68 /**
     69   Determine if a capsule needs to be processed.
     70   The means by which the presence of a capsule is determined is platform
     71   specific. For example, an implementation could be driven by the presence
     72   of a Capsule EFI Variable containing a list of EFI_CAPSULE_BLOCK_DESCRIPTOR
     73   entries. If present, return EFI_SUCCESS, otherwise return EFI_NOT_FOUND.
     74 
     75   @param[in] PeiServices   Pointer to the PEI Services Table.
     76 
     77   @retval EFI_SUCCESS     If a capsule is available.
     78   @retval EFI_NOT_FOUND   No capsule detected.
     79 
     80 **/
     81 typedef
     82 EFI_STATUS
     83 (EFIAPI *EFI_PEI_CAPSULE_CHECK_CAPSULE_UPDATE)(
     84   IN EFI_PEI_SERVICES  **PeiServices
     85   );
     86 
     87 /**
     88   The Capsule PPI service that gets called after memory is available. The
     89   capsule coalesce function, which must be called first, returns a base
     90   address and size. Once the memory init PEIM has discovered memory,
     91   it should call this function and pass in the base address and size
     92   returned by the Coalesce() function. Then this function can create a
     93   capsule HOB and return.
     94 
     95   @par Notes:
     96     This function assumes it will not be called until the
     97     actual capsule update.
     98 
     99   @param[in] PeiServices   Pointer to the PEI Services Table.
    100   @param[in] CapsuleBase   Address returned by the capsule coalesce function.
    101   @param[in] CapsuleSize   Value returned by the capsule coalesce function.
    102 
    103   @retval EFI_VOLUME_CORRUPTED   CapsuleBase does not appear to point to a
    104                                  coalesced capsule.
    105   @retval EFI_SUCCESS            Capsule HOB was created successfully.
    106 
    107 **/
    108 typedef
    109 EFI_STATUS
    110 (EFIAPI *EFI_PEI_CAPSULE_CREATE_STATE)(
    111   IN EFI_PEI_SERVICES  **PeiServices,
    112   IN VOID              *CapsuleBase,
    113   IN UINTN             CapsuleSize
    114   );
    115 
    116 ///
    117 /// This PPI provides several services in PEI to work with the underlying
    118 /// capsule capabilities of the platform.  These services include the ability
    119 /// for PEI to coalesce a capsule from a scattered set of memory locations
    120 /// into a contiguous space in memory, detect if a capsule is present for
    121 /// processing, and once memory is available, create a HOB for the capsule.
    122 ///
    123 struct _EFI_PEI_CAPSULE_PPI {
    124   EFI_PEI_CAPSULE_COALESCE              Coalesce;
    125   EFI_PEI_CAPSULE_CHECK_CAPSULE_UPDATE  CheckCapsuleUpdate;
    126   EFI_PEI_CAPSULE_CREATE_STATE          CreateState;
    127 };
    128 
    129 ///
    130 /// Keep name backwards compatible before PI Version 1.4
    131 ///
    132 extern EFI_GUID gPeiCapsulePpiGuid;
    133 
    134 extern EFI_GUID gEfiPeiCapsulePpiGuid;
    135 
    136 #endif // #ifndef _PEI_CAPSULE_PPI_H_
    137