1 /** @file 2 Private functions and sturctures used by the Opal UEFI Driver. 3 4 Copyright (c) 2016, 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 _OPAL_HII_PRIVATE_H_ 16 #define _OPAL_HII_PRIVATE_H_ 17 18 19 20 #include <Library/OpalPasswordSupportLib.h> 21 #include <Protocol/HiiConfigAccess.h> 22 23 #include "OpalHii.h" 24 #include "OpalHiiFormValues.h" 25 26 27 #define OPAL_PASSWORD_CONFIG_GUID \ 28 { \ 29 0x0d510a4f, 0xa81b, 0x473f, { 0x87, 0x07, 0xb7, 0xfd, 0xfb, 0xc0, 0x45, 0xba } \ 30 } 31 32 #pragma pack(1) 33 34 typedef struct { 35 UINT16 Id: HII_KEY_ID_BITS; 36 UINT16 Index: HII_KEY_INDEX_BITS; 37 UINT16 Flag: HII_KEY_FLAG_BITS; 38 } KEY_BITS; 39 40 typedef union { 41 UINT16 Raw; 42 KEY_BITS KeyBits; 43 } HII_KEY; 44 45 typedef struct { 46 VENDOR_DEVICE_PATH VendorDevicePath; 47 EFI_DEVICE_PATH_PROTOCOL End; 48 } HII_VENDOR_DEVICE_PATH; 49 50 /** 51 * Opal PSID Authority utilized for PSID revert 52 * 53 * The type indicates the structure of the PSID authority 54 */ 55 typedef struct { 56 UINT8 Psid[PSID_CHARACTER_LENGTH]; 57 } TCG_PSID; 58 59 /** 60 This function processes the results of changes in configuration. 61 62 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 63 @param Configuration A null-terminated Unicode string in <ConfigResp> 64 format. 65 @param Progress A pointer to a string filled in with the offset of 66 the most recent '&' before the first failing 67 name/value pair (or the beginning of the string if 68 the failure is in the first name/value pair) or 69 the terminating NULL if all was successful. 70 71 @retval EFI_SUCCESS The Results is processed successfully. 72 @retval EFI_INVALID_PARAMETER Configuration is NULL. 73 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this 74 driver. 75 76 **/ 77 EFI_STATUS 78 EFIAPI 79 RouteConfig( 80 CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 81 CONST EFI_STRING Configuration, 82 EFI_STRING *Progress 83 ); 84 85 /** 86 This function allows a caller to extract the current configuration for one 87 or more named elements from the target driver. 88 89 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 90 @param Request A null-terminated Unicode string in 91 <ConfigRequest> format. 92 @param Progress On return, points to a character in the Request 93 string. Points to the string's null terminator if 94 request was successful. Points to the most recent 95 '&' before the first failing name/value pair (or 96 the beginning of the string if the failure is in 97 the first name/value pair) if the request was not 98 successful. 99 @param Results A null-terminated Unicode string in 100 <ConfigAltResp> format which has all values filled 101 in for the names in the Request string. String to 102 be allocated by the called function. 103 104 @retval EFI_SUCCESS The Results is filled with the requested values. 105 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. 106 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name. 107 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this 108 driver. 109 110 **/ 111 EFI_STATUS 112 EFIAPI 113 ExtractConfig( 114 CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 115 CONST EFI_STRING Request, 116 EFI_STRING *Progress, 117 EFI_STRING *Results 118 ); 119 120 /** 121 This function processes the results of changes in configuration. 122 123 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 124 @param Action Specifies the type of action taken by the browser. 125 @param QuestionId A unique value which is sent to the original 126 exporting driver so that it can identify the type 127 of data to expect. 128 @param Type The type of value for the question. 129 @param Value A pointer to the data being sent to the original 130 exporting driver. 131 @param ActionRequest On return, points to the action requested by the 132 callback function. 133 134 @retval EFI_SUCCESS The callback successfully handled the action. 135 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the 136 variable and its data. 137 @retval EFI_DEVICE_ERROR The variable could not be saved. 138 @retval EFI_UNSUPPORTED The specified Action is not supported by the 139 callback. 140 141 **/ 142 EFI_STATUS 143 EFIAPI 144 DriverCallback( 145 CONST EFI_HII_CONFIG_ACCESS_PROTOCOL* This, 146 EFI_BROWSER_ACTION Action, 147 EFI_QUESTION_ID QuestionId, 148 UINT8 Type, 149 EFI_IFR_TYPE_VALUE* Value, 150 EFI_BROWSER_ACTION_REQUEST* ActionRequest 151 ); 152 153 /** 154 155 Pass the current system state to the bios via the hii_G_Configuration. 156 157 **/ 158 VOID 159 OpalHiiSetBrowserData ( 160 VOID 161 ); 162 163 /** 164 165 Populate the hii_g_Configuraton with the browser Data. 166 167 **/ 168 VOID 169 OpalHiiGetBrowserData ( 170 VOID 171 ); 172 173 /** 174 Draws the disk info form. 175 176 @retval EFI_SUCCESS Draw the disk info success. 177 178 **/ 179 EFI_STATUS 180 HiiPopulateDiskInfoForm( 181 VOID 182 ); 183 184 /** 185 Update the global Disk index info. 186 187 @param Index The input disk index info. 188 189 @retval EFI_SUCCESS Update the disk index info success. 190 191 **/ 192 EFI_STATUS 193 HiiSelectDisk( 194 UINT8 Index 195 ); 196 197 /** 198 Use the input password to do the specified action. 199 200 @param Str The input password saved in. 201 202 @retval EFI_SUCCESS Do the required action success. 203 @retval Others Other error occur. 204 205 **/ 206 EFI_STATUS 207 HiiPasswordEntered( 208 EFI_STRING_ID Str 209 ); 210 211 /** 212 Update block sid info. 213 214 @param PpRequest Input the Pp Request. 215 216 @retval EFI_SUCCESS Do the required action success. 217 @retval Others Other error occur. 218 219 **/ 220 EFI_STATUS 221 HiiSetBlockSidAction ( 222 UINT32 PpRequest 223 ); 224 225 /** 226 Reverts the Opal disk to factory default. 227 228 @param PsidStringId The string id for the PSID info. 229 230 @retval EFI_SUCCESS Do the required action success. 231 232 **/ 233 EFI_STATUS 234 HiiPsidRevert( 235 EFI_STRING_ID PsidStringId 236 ); 237 238 /** 239 Get disk name string id. 240 241 @param DiskIndex The input disk index info. 242 243 @retval The disk name string id. 244 245 **/ 246 EFI_STRING_ID 247 GetDiskNameStringId( 248 UINT8 DiskIndex 249 ); 250 251 /** 252 Update the device info. 253 254 @param OpalDisk The Opal device. 255 256 @retval EFI_SUCESS Initialize the device success. 257 @retval EFI_DEVICE_ERROR Get info from device failed. 258 @retval EFI_INVALID_PARAMETER Not get Msid info before get ownership info. 259 260 **/ 261 EFI_STATUS 262 OpalDiskUpdateStatus ( 263 OPAL_DISK *OpalDisk 264 ); 265 266 #pragma pack() 267 268 #endif // _HII_P_H_ 269