1 /** @file 2 FrontPage routines to handle the callbacks and browser calls 3 4 Copyright (c) 2004 - 2012, 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 _FRONT_PAGE_H_ 16 #define _FRONT_PAGE_H_ 17 18 #include "DeviceMngr/DeviceManager.h" 19 #include "BootMaint/BootMaint.h" 20 #include "BootMngr/BootManager.h" 21 #include "String.h" 22 23 24 // 25 // These are the VFR compiler generated data representing our VFR data. 26 // 27 extern UINT8 FrontPageVfrBin[]; 28 29 extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2; 30 31 extern UINTN gCallbackKey; 32 extern BOOLEAN gConnectAllHappened; 33 34 // 35 // Boot video resolution and text mode. 36 // 37 extern UINT32 mBootHorizontalResolution; 38 extern UINT32 mBootVerticalResolution; 39 extern UINT32 mBootTextModeColumn; 40 extern UINT32 mBootTextModeRow; 41 // 42 // BIOS setup video resolution and text mode. 43 // 44 extern UINT32 mSetupTextModeColumn; 45 extern UINT32 mSetupTextModeRow; 46 extern UINT32 mSetupHorizontalResolution; 47 extern UINT32 mSetupVerticalResolution; 48 49 50 #define ONE_SECOND 10000000 51 52 /// 53 /// The size of a 3 character ISO639 language code. 54 /// 55 #define ISO_639_2_ENTRY_SIZE 3 56 57 // 58 // This is the VFR compiler generated header file which defines the 59 // string identifiers. 60 // 61 #define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001 62 63 // 64 // These are defined as the same with vfr file 65 // 66 #define FRONT_PAGE_FORM_ID 0x1000 67 68 #define FRONT_PAGE_KEY_CONTINUE 0x1000 69 #define FRONT_PAGE_KEY_LANGUAGE 0x1234 70 #define FRONT_PAGE_KEY_BOOT_MANAGER 0x1064 71 #define FRONT_PAGE_KEY_DEVICE_MANAGER 0x8567 72 #define FRONT_PAGE_KEY_BOOT_MAINTAIN 0x9876 73 74 #define LABEL_SELECT_LANGUAGE 0x1000 75 #define LABEL_END 0xffff 76 77 #define FRONT_PAGE_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('F', 'P', 'C', 'B') 78 79 typedef struct { 80 UINTN Signature; 81 82 // 83 // HII relative handles 84 // 85 EFI_HII_HANDLE HiiHandle; 86 EFI_HANDLE DriverHandle; 87 EFI_STRING_ID *LanguageToken; 88 89 // 90 // Produced protocols 91 // 92 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; 93 } FRONT_PAGE_CALLBACK_DATA; 94 95 #define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \ 96 CR (a, \ 97 FRONT_PAGE_CALLBACK_DATA, \ 98 ConfigAccess, \ 99 FRONT_PAGE_CALLBACK_DATA_SIGNATURE \ 100 ) 101 102 /** 103 This function allows a caller to extract the current configuration for one 104 or more named elements from the target driver. 105 106 107 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 108 @param Request - A null-terminated Unicode string in <ConfigRequest> format. 109 @param Progress - On return, points to a character in the Request string. 110 Points to the string's null terminator if request was successful. 111 Points to the most recent '&' before the first failing name/value 112 pair (or the beginning of the string if the failure is in the 113 first name/value pair) if the request was not successful. 114 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which 115 has all values filled in for the names in the Request string. 116 String to 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 NULL, illegal syntax, or unknown name. 121 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver. 122 123 **/ 124 EFI_STATUS 125 EFIAPI 126 FakeExtractConfig ( 127 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 128 IN CONST EFI_STRING Request, 129 OUT EFI_STRING *Progress, 130 OUT EFI_STRING *Results 131 ); 132 133 /** 134 This function processes the results of changes in configuration. 135 136 137 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 138 @param Configuration - A null-terminated Unicode string in <ConfigResp> format. 139 @param Progress - A pointer to a string filled in with the offset of the most 140 recent '&' before the first failing name/value pair (or the 141 beginning of the string if the failure is in the first 142 name/value pair) or the terminating NULL if all was successful. 143 144 @retval EFI_SUCCESS The Results is processed successfully. 145 @retval EFI_INVALID_PARAMETER Configuration is NULL. 146 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver. 147 148 **/ 149 EFI_STATUS 150 EFIAPI 151 FakeRouteConfig ( 152 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 153 IN CONST EFI_STRING Configuration, 154 OUT EFI_STRING *Progress 155 ); 156 157 /** 158 This function processes the results of changes in configuration. 159 160 161 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 162 @param Action - Specifies the type of action taken by the browser. 163 @param QuestionId - A unique value which is sent to the original exporting driver 164 so that it can identify the type of data to expect. 165 @param Type - The type of value for the question. 166 @param Value - A pointer to the data being sent to the original exporting driver. 167 @param ActionRequest - On return, points to the action requested by the callback function. 168 169 @retval EFI_SUCCESS The callback successfully handled the action. 170 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. 171 @retval EFI_DEVICE_ERROR The variable could not be saved. 172 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback. 173 174 **/ 175 EFI_STATUS 176 EFIAPI 177 FrontPageCallback ( 178 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 179 IN EFI_BROWSER_ACTION Action, 180 IN EFI_QUESTION_ID QuestionId, 181 IN UINT8 Type, 182 IN EFI_IFR_TYPE_VALUE *Value, 183 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest 184 ); 185 186 /** 187 Initialize HII information for the FrontPage 188 189 190 @param InitializeHiiData TRUE if HII elements need to be initialized. 191 192 @retval EFI_SUCCESS The operation is successful. 193 @retval EFI_DEVICE_ERROR If the dynamic opcode creation failed. 194 195 **/ 196 EFI_STATUS 197 InitializeFrontPage ( 198 IN BOOLEAN InitializeHiiData 199 ); 200 201 /** 202 Acquire the string associated with the ProducerGuid and return it. 203 204 205 @param ProducerGuid - The Guid to search the HII database for 206 @param Token - The token value of the string to extract 207 @param String - The string that is extracted 208 209 @retval EFI_SUCCESS The function returns EFI_SUCCESS always. 210 211 **/ 212 EFI_STATUS 213 GetProducerString ( 214 IN EFI_GUID *ProducerGuid, 215 IN EFI_STRING_ID Token, 216 OUT CHAR16 **String 217 ); 218 219 /** 220 This function is the main entry of the platform setup entry. 221 The function will present the main menu of the system setup, 222 this is the platform reference part and can be customize. 223 224 225 @param TimeoutDefault - The fault time out value before the system 226 continue to boot. 227 @param ConnectAllHappened - The indicater to check if the connect all have 228 already happened. 229 230 **/ 231 VOID 232 PlatformBdsEnterFrontPage ( 233 IN UINT16 TimeoutDefault, 234 IN BOOLEAN ConnectAllHappened 235 ); 236 237 /** 238 This function will change video resolution and text mode 239 according to defined setup mode or defined boot mode 240 241 @param IsSetupMode Indicate mode is changed to setup mode or boot mode. 242 243 @retval EFI_SUCCESS Mode is changed successfully. 244 @retval Others Mode failed to be changed. 245 246 **/ 247 EFI_STATUS 248 EFIAPI 249 BdsSetConsoleMode ( 250 BOOLEAN IsSetupMode 251 ); 252 253 #endif // _FRONT_PAGE_H_ 254 255