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