Home | History | Annotate | Download | only in Library
      1 /** @file
      2   Provides services to create, get and update HSTI table in AIP protocol.
      3 
      4   Copyright (c) 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 #ifndef __HSTI_LIB_H__
     16 #define __HSTI_LIB_H__
     17 
     18 /**
     19   Publish HSTI table in AIP protocol.
     20 
     21   One system should have only one PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE.
     22 
     23   If the Role is NOT PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE,
     24   SecurityFeaturesRequired field will be ignored.
     25 
     26   @param Hsti      HSTI data
     27   @param HstiSize  HSTI size
     28 
     29   @retval EFI_SUCCESS          The HSTI data is published in AIP protocol.
     30   @retval EFI_ALREADY_STARTED  There is already HSTI table with Role and ImplementationID published in system.
     31   @retval EFI_VOLUME_CORRUPTED The input HSTI data does not follow HSTI specification.
     32   @retval EFI_OUT_OF_RESOURCES There is not enough system resource to publish HSTI data in AIP protocol.
     33 **/
     34 EFI_STATUS
     35 EFIAPI
     36 HstiLibSetTable (
     37   IN VOID                     *Hsti,
     38   IN UINTN                    HstiSize
     39   );
     40 
     41 /**
     42   Search HSTI table in AIP protocol, and return the data.
     43   This API will return the HSTI table with indicated Role and ImplementationID,
     44   NULL ImplementationID means to find the first HSTI table with indicated Role.
     45 
     46   @param Role             Role of HSTI data.
     47   @param ImplementationID ImplementationID of HSTI data.
     48                           NULL means find the first one match Role.
     49   @param Hsti             HSTI data. This buffer is allocated by callee, and it
     50                           is the responsibility of the caller to free it after
     51                           using it.
     52   @param HstiSize         HSTI size
     53 
     54   @retval EFI_SUCCESS          The HSTI data in AIP protocol is returned.
     55   @retval EFI_NOT_FOUND        There is not HSTI table with the Role and ImplementationID published in system.
     56 **/
     57 EFI_STATUS
     58 EFIAPI
     59 HstiLibGetTable (
     60   IN UINT32                   Role,
     61   IN CHAR16                   *ImplementationID OPTIONAL,
     62   OUT VOID                    **Hsti,
     63   OUT UINTN                   *HstiSize
     64   );
     65 
     66 /**
     67   Set FeaturesVerified in published HSTI table.
     68   This API will update the HSTI table with indicated Role and ImplementationID,
     69   NULL ImplementationID means to find the first HSTI table with indicated Role.
     70 
     71   @param Role             Role of HSTI data.
     72   @param ImplementationID ImplementationID of HSTI data.
     73                           NULL means find the first one match Role.
     74   @param ByteIndex        Byte index of FeaturesVerified of HSTI data.
     75   @param BitMask          Bit mask of FeaturesVerified of HSTI data.
     76 
     77   @retval EFI_SUCCESS          The FeaturesVerified of HSTI data updated in AIP protocol.
     78   @retval EFI_NOT_STARTED      There is not HSTI table with the Role and ImplementationID published in system.
     79   @retval EFI_UNSUPPORTED      The ByteIndex is invalid.
     80 **/
     81 EFI_STATUS
     82 EFIAPI
     83 HstiLibSetFeaturesVerified (
     84   IN UINT32                   Role,
     85   IN CHAR16                   *ImplementationID, OPTIONAL
     86   IN UINT32                   ByteIndex,
     87   IN UINT8                    BitMask
     88   );
     89 
     90 /**
     91   Clear FeaturesVerified in published HSTI table.
     92   This API will update the HSTI table with indicated Role and ImplementationID,
     93   NULL ImplementationID means to find the first HSTI table with indicated Role.
     94 
     95   @param Role             Role of HSTI data.
     96   @param ImplementationID ImplementationID of HSTI data.
     97                           NULL means find the first one match Role.
     98   @param ByteIndex        Byte index of FeaturesVerified of HSTI data.
     99   @param BitMask          Bit mask of FeaturesVerified of HSTI data.
    100 
    101   @retval EFI_SUCCESS          The FeaturesVerified of HSTI data updated in AIP protocol.
    102   @retval EFI_NOT_STARTED      There is not HSTI table with the Role and ImplementationID published in system.
    103   @retval EFI_UNSUPPORTED      The ByteIndex is invalid.
    104 **/
    105 EFI_STATUS
    106 EFIAPI
    107 HstiLibClearFeaturesVerified (
    108   IN UINT32                   Role,
    109   IN CHAR16                   *ImplementationID, OPTIONAL
    110   IN UINT32                   ByteIndex,
    111   IN UINT8                    BitMask
    112   );
    113 
    114 /**
    115   Append ErrorString in published HSTI table.
    116   This API will update the HSTI table with indicated Role and ImplementationID,
    117   NULL ImplementationID means to find the first HSTI table with indicated Role.
    118 
    119   @param Role             Role of HSTI data.
    120   @param ImplementationID ImplementationID of HSTI data.
    121                           NULL means find the first one match Role.
    122   @param ErrorString      ErrorString of HSTI data.
    123 
    124   @retval EFI_SUCCESS          The ErrorString of HSTI data is updated in AIP protocol.
    125   @retval EFI_NOT_STARTED      There is not HSTI table with the Role and ImplementationID published in system.
    126   @retval EFI_OUT_OF_RESOURCES There is not enough system resource to update ErrorString.
    127 **/
    128 EFI_STATUS
    129 EFIAPI
    130 HstiLibAppendErrorString (
    131   IN UINT32                   Role,
    132   IN CHAR16                   *ImplementationID, OPTIONAL
    133   IN CHAR16                   *ErrorString
    134   );
    135 
    136 /**
    137   Set a new ErrorString in published HSTI table.
    138   This API will update the HSTI table with indicated Role and ImplementationID,
    139   NULL ImplementationID means to find the first HSTI table with indicated Role.
    140 
    141   @param Role             Role of HSTI data.
    142   @param ImplementationID ImplementationID of HSTI data.
    143                           NULL means find the first one match Role.
    144   @param ErrorString      ErrorString of HSTI data.
    145 
    146   @retval EFI_SUCCESS          The ErrorString of HSTI data is updated in AIP protocol.
    147   @retval EFI_NOT_STARTED      There is not HSTI table with the Role and ImplementationID published in system.
    148   @retval EFI_OUT_OF_RESOURCES There is not enough system resource to update ErrorString.
    149 **/
    150 EFI_STATUS
    151 EFIAPI
    152 HstiLibSetErrorString (
    153   IN UINT32                   Role,
    154   IN CHAR16                   *ImplementationID, OPTIONAL
    155   IN CHAR16                   *ErrorString
    156   );
    157 
    158 #endif
    159