1 /** @file 2 TCG MOR (Memory Overwrite Request) Lock Control Driver header file. 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 _EFI_TCG_MOR_LOCK_H_ 16 #define _EFI_TCG_MOR_LOCK_H_ 17 18 /** 19 This service is a wrapper for the UEFI Runtime Service GetVariable(). 20 21 @param VariableName the name of the vendor's variable, it's a Null-Terminated Unicode String 22 @param VendorGuid Unify identifier for vendor. 23 @param Attributes Point to memory location to return the attributes of variable. If the point 24 is NULL, the parameter would be ignored. 25 @param DataSize As input, point to the maximum size of return Data-Buffer. 26 As output, point to the actual size of the returned Data-Buffer. 27 @param Data Point to return Data-Buffer. 28 29 @retval EFI_SUCCESS The function completed successfully. 30 @retval EFI_NOT_FOUND The variable was not found. 31 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has 32 been updated with the size needed to complete the request. 33 @retval EFI_INVALID_PARAMETER VariableName is NULL. 34 @retval EFI_INVALID_PARAMETER VendorGuid is NULL. 35 @retval EFI_INVALID_PARAMETER DataSize is NULL. 36 @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL. 37 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. 38 @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure. 39 **/ 40 EFI_STATUS 41 EFIAPI 42 InternalGetVariable ( 43 IN CHAR16 *VariableName, 44 IN EFI_GUID *VendorGuid, 45 OUT UINT32 *Attributes OPTIONAL, 46 IN OUT UINTN *DataSize, 47 OUT VOID *Data 48 ); 49 50 /** 51 This service is a wrapper for the UEFI Runtime Service SetVariable() 52 53 @param VariableName the name of the vendor's variable, as a 54 Null-Terminated Unicode String 55 @param VendorGuid Unify identifier for vendor. 56 @param Attributes Point to memory location to return the attributes of variable. If the point 57 is NULL, the parameter would be ignored. 58 @param DataSize The size in bytes of Data-Buffer. 59 @param Data Point to the content of the variable. 60 61 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as 62 defined by the Attributes. 63 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the 64 DataSize exceeds the maximum allowed. 65 @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string. 66 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. 67 @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure. 68 @retval EFI_WRITE_PROTECTED The variable in question is read-only. 69 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted. 70 @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 71 set but the AuthInfo does NOT pass the validation check carried 72 out by the firmware. 73 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found. 74 75 **/ 76 EFI_STATUS 77 EFIAPI 78 InternalSetVariable ( 79 IN CHAR16 *VariableName, 80 IN EFI_GUID *VendorGuid, 81 IN UINT32 Attributes, 82 IN UINTN DataSize, 83 IN VOID *Data 84 ); 85 86 /** 87 This service is a checker handler for the UEFI Runtime Service SetVariable() 88 89 @param VariableName the name of the vendor's variable, as a 90 Null-Terminated Unicode String 91 @param VendorGuid Unify identifier for vendor. 92 @param Attributes Point to memory location to return the attributes of variable. If the point 93 is NULL, the parameter would be ignored. 94 @param DataSize The size in bytes of Data-Buffer. 95 @param Data Point to the content of the variable. 96 97 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as 98 defined by the Attributes. 99 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the 100 DataSize exceeds the maximum allowed. 101 @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string. 102 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. 103 @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure. 104 @retval EFI_WRITE_PROTECTED The variable in question is read-only. 105 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted. 106 @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 107 set but the AuthInfo does NOT pass the validation check carried 108 out by the firmware. 109 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found. 110 111 **/ 112 EFI_STATUS 113 EFIAPI 114 SetVariableCheckHandlerMor ( 115 IN CHAR16 *VariableName, 116 IN EFI_GUID *VendorGuid, 117 IN UINT32 Attributes, 118 IN UINTN DataSize, 119 IN VOID *Data 120 ); 121 122 /** 123 Entry Point for MOR Lock Control driver. 124 125 @param[in] ImageHandle Image handle of this driver. 126 @param[in] SystemTable A Pointer to the EFI System Table. 127 128 @retval EFI_SUCEESS 129 @return Others Some error occurs. 130 **/ 131 EFI_STATUS 132 EFIAPI 133 MorLockDriverInit ( 134 VOID 135 ); 136 137 #endif 138