1 /** @file 2 The header file of HII Config Access protocol implementation of TCG2 3 configuration module. 4 5 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. 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 **/ 15 16 #ifndef __TCG2_CONFIG_IMPL_H__ 17 #define __TCG2_CONFIG_IMPL_H__ 18 19 #include <Uefi.h> 20 21 #include <Protocol/HiiConfigAccess.h> 22 #include <Protocol/HiiConfigRouting.h> 23 #include <Protocol/Tcg2Protocol.h> 24 #include <Protocol/VariableLock.h> 25 26 #include <Library/BaseLib.h> 27 #include <Library/BaseMemoryLib.h> 28 #include <Library/DebugLib.h> 29 #include <Library/MemoryAllocationLib.h> 30 #include <Library/UefiBootServicesTableLib.h> 31 #include <Library/UefiRuntimeServicesTableLib.h> 32 #include <Library/UefiHiiServicesLib.h> 33 #include <Library/UefiLib.h> 34 #include <Library/HiiLib.h> 35 #include <Library/DevicePathLib.h> 36 #include <Library/PcdLib.h> 37 #include <Library/PrintLib.h> 38 #include <Library/Tcg2PhysicalPresenceLib.h> 39 40 #include <Guid/MdeModuleHii.h> 41 42 #include "Tcg2ConfigNvData.h" 43 44 // 45 // Tool generated IFR binary data and String package data 46 // 47 extern UINT8 Tcg2ConfigBin[]; 48 extern UINT8 Tcg2ConfigDxeStrings[]; 49 50 /// 51 /// HII specific Vendor Device Path definition. 52 /// 53 typedef struct { 54 VENDOR_DEVICE_PATH VendorDevicePath; 55 EFI_DEVICE_PATH_PROTOCOL End; 56 } HII_VENDOR_DEVICE_PATH; 57 58 typedef struct { 59 UINTN Signature; 60 61 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; 62 EFI_HII_HANDLE HiiHandle; 63 EFI_HANDLE DriverHandle; 64 65 UINT8 TpmDeviceDetected; 66 EFI_TCG2_PROTOCOL *Tcg2Protocol; 67 EFI_TCG2_BOOT_SERVICE_CAPABILITY ProtocolCapability; 68 UINT32 PCRBanksDesired; 69 } TCG2_CONFIG_PRIVATE_DATA; 70 71 extern TCG2_CONFIG_PRIVATE_DATA mTcg2ConfigPrivateDateTemplate; 72 extern TCG2_CONFIG_PRIVATE_DATA *mTcg2ConfigPrivateDate; 73 #define TCG2_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'r', 'E', 'D') 74 #define TCG2_CONFIG_PRIVATE_DATA_FROM_THIS(a) CR (a, TCG2_CONFIG_PRIVATE_DATA, ConfigAccess, TCG2_CONFIG_PRIVATE_DATA_SIGNATURE) 75 76 77 /** 78 This function publish the TCG2 configuration Form for TPM device. 79 80 @param[in, out] PrivateData Points to TCG2 configuration private data. 81 82 @retval EFI_SUCCESS HII Form is installed for this network device. 83 @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation. 84 @retval Others Other errors as indicated. 85 86 **/ 87 EFI_STATUS 88 InstallTcg2ConfigForm ( 89 IN OUT TCG2_CONFIG_PRIVATE_DATA *PrivateData 90 ); 91 92 /** 93 This function removes TCG2 configuration Form. 94 95 @param[in, out] PrivateData Points to TCG2 configuration private data. 96 97 **/ 98 VOID 99 UninstallTcg2ConfigForm ( 100 IN OUT TCG2_CONFIG_PRIVATE_DATA *PrivateData 101 ); 102 103 /** 104 This function allows a caller to extract the current configuration for one 105 or more named elements from the target driver. 106 107 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 108 @param[in] Request A null-terminated Unicode string in 109 <ConfigRequest> format. 110 @param[out] Progress On return, points to a character in the Request 111 string. Points to the string's null terminator if 112 request was successful. Points to the most recent 113 '&' before the first failing name/value pair (or 114 the beginning of the string if the failure is in 115 the first name/value pair) if the request was not 116 successful. 117 @param[out] Results A null-terminated Unicode string in 118 <ConfigAltResp> format which has all values filled 119 in for the names in the Request string. String to 120 be allocated by the called function. 121 122 @retval EFI_SUCCESS The Results is filled with the requested values. 123 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. 124 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name. 125 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this 126 driver. 127 128 **/ 129 EFI_STATUS 130 EFIAPI 131 Tcg2ExtractConfig ( 132 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 133 IN CONST EFI_STRING Request, 134 OUT EFI_STRING *Progress, 135 OUT EFI_STRING *Results 136 ); 137 138 /** 139 This function processes the results of changes in configuration. 140 141 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 142 @param[in] Configuration A null-terminated Unicode string in <ConfigResp> 143 format. 144 @param[out] Progress A pointer to a string filled in with the offset of 145 the most recent '&' before the first failing 146 name/value pair (or the beginning of the string if 147 the failure is in the first name/value pair) or 148 the terminating NULL if all was successful. 149 150 @retval EFI_SUCCESS The Results is processed successfully. 151 @retval EFI_INVALID_PARAMETER Configuration is NULL. 152 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this 153 driver. 154 155 **/ 156 EFI_STATUS 157 EFIAPI 158 Tcg2RouteConfig ( 159 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 160 IN CONST EFI_STRING Configuration, 161 OUT EFI_STRING *Progress 162 ); 163 164 /** 165 This function processes the results of changes in configuration. 166 167 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 168 @param[in] Action Specifies the type of action taken by the browser. 169 @param[in] QuestionId A unique value which is sent to the original 170 exporting driver so that it can identify the type 171 of data to expect. 172 @param[in] Type The type of value for the question. 173 @param[in] Value A pointer to the data being sent to the original 174 exporting driver. 175 @param[out] ActionRequest On return, points to the action requested by the 176 callback function. 177 178 @retval EFI_SUCCESS The callback successfully handled the action. 179 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the 180 variable and its data. 181 @retval EFI_DEVICE_ERROR The variable could not be saved. 182 @retval EFI_UNSUPPORTED The specified Action is not supported by the 183 callback. 184 185 **/ 186 EFI_STATUS 187 EFIAPI 188 Tcg2Callback ( 189 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 190 IN EFI_BROWSER_ACTION Action, 191 IN EFI_QUESTION_ID QuestionId, 192 IN UINT8 Type, 193 IN EFI_IFR_TYPE_VALUE *Value, 194 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest 195 ); 196 197 #endif 198