1 /** @file 2 3 This file contains global defines and prototype definitions 4 for the Framework HII to Uefi HII Thunk Module. 5 6 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 http://opensource.org/licenses/bsd-license.php 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 15 **/ 16 17 #ifndef _HIIDATABASE_H_ 18 #define _HIIDATABASE_H_ 19 20 21 #include <FrameworkDxe.h> 22 23 #include <Guid/GlobalVariable.h> 24 #include <Protocol/FrameworkFormCallback.h> 25 #include <Protocol/FrameworkHii.h> 26 #include <Protocol/FrameworkFormBrowser.h> 27 28 // 29 // UEFI HII Protocols 30 // 31 #include <Protocol/HiiFont.h> 32 #include <Protocol/HiiImage.h> 33 #include <Protocol/HiiString.h> 34 #include <Protocol/HiiDatabase.h> 35 #include <Protocol/HiiConfigRouting.h> 36 #include <Protocol/HiiConfigAccess.h> 37 #include <Protocol/UgaDraw.h> 38 #include <Guid/HiiFormMapMethodGuid.h> 39 #include <Guid/FrameworkBdsFrontPageFormSet.h> 40 41 #include <Library/BaseLib.h> 42 #include <Library/DebugLib.h> 43 #include <Library/UefiDriverEntryPoint.h> 44 #include <Library/MemoryAllocationLib.h> 45 #include <Library/BaseMemoryLib.h> 46 #include <Library/UefiBootServicesTableLib.h> 47 #include <Library/UefiRuntimeServicesTableLib.h> 48 #include <Library/HiiLib.h> 49 #include <Library/UefiLib.h> 50 #include <Library/PcdLib.h> 51 #include <Library/LanguageLib.h> 52 #include <Library/PrintLib.h> 53 54 #include <Guid/MdeModuleHii.h> 55 56 #include "UefiIfrParser.h" 57 58 59 // 60 // VARSTORE ID of 0 for Buffer Storage Type Storage is defined as invalid in UEFI 2.1 HII. VARSTORE ID 61 // 0 is the default VarStore ID for storage without explicit declaration in Framework HII 0.92. EDK II UEFI VFR compiler 62 // in compatible mode will assign 0x0001 as UEFI VARSTORE ID to this default storage id in Framework VFR without 63 // VARSTORE declaration. 64 // 65 // In addition, the Name of Default VarStore is assumed to be L"Setup" for those storage without explicit VARSTORE declaration in the formset 66 // by Framework HII. EDK II UEFI VFR compiler in compatible mode hard-coded L"Setup" as VARSTORE name. 67 // 68 #define FRAMEWORK_RESERVED_VARSTORE_ID 0x0001 69 #define FRAMEWORK_RESERVED_VARSTORE_NAME L"Setup" 70 71 /// 72 /// The size of a 3 character ISO639 language code. 73 /// 74 #define ISO_639_2_ENTRY_SIZE 3 75 76 #pragma pack (1) 77 typedef struct { 78 EFI_HII_PACK_HEADER FrameworkPackageHeader; 79 EFI_HII_PACKAGE_HEADER PackageHeader; 80 } TIANO_AUTOGEN_PACKAGES_HEADER; 81 #pragma pack () 82 83 #define HII_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, HII_THUNK_PRIVATE_DATA, Hii, HII_THUNK_PRIVATE_DATA_SIGNATURE) 84 #define HII_THUNK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'i', 'I', 'T') 85 typedef struct { 86 UINTN Signature; 87 EFI_HANDLE Handle; 88 EFI_HII_PROTOCOL Hii; 89 90 // 91 // The head of link list for all HII_THUNK_CONTEXT. 92 // 93 LIST_ENTRY ThunkContextListHead; 94 95 EFI_HANDLE RemovePackNotifyHandle; 96 EFI_HANDLE AddPackNotifyHandle; 97 } HII_THUNK_PRIVATE_DATA; 98 99 100 101 102 103 #define QUESTION_ID_MAP_ENTRY_FROM_LINK(Record) CR(Record, QUESTION_ID_MAP_ENTRY, Link, QUESTION_ID_MAP_ENTRY_SIGNATURE) 104 #define QUESTION_ID_MAP_ENTRY_SIGNATURE SIGNATURE_32 ('Q', 'I', 'M', 'E') 105 typedef struct { 106 UINT32 Signature; 107 LIST_ENTRY Link; 108 UINT16 FwQId; 109 EFI_QUESTION_ID UefiQid; 110 } QUESTION_ID_MAP_ENTRY; 111 112 113 114 #define QUESTION_ID_MAP_FROM_LINK(Record) CR(Record, QUESTION_ID_MAP, Link, QUESTION_ID_MAP_SIGNATURE) 115 #define QUESTION_ID_MAP_SIGNATURE SIGNATURE_32 ('Q', 'I', 'M', 'P') 116 typedef struct { 117 UINT32 Signature; 118 LIST_ENTRY Link; 119 UINT16 VarStoreId; 120 UINTN VarSize; 121 LIST_ENTRY MapEntryListHead; 122 } QUESTION_ID_MAP; 123 124 125 126 #define HII_THUNK_CONTEXT_FROM_LINK(Record) CR(Record, HII_THUNK_CONTEXT, Link, HII_THUNK_CONTEXT_SIGNATURE) 127 #define HII_THUNK_CONTEXT_SIGNATURE SIGNATURE_32 ('H', 'T', 'H', 'M') 128 typedef struct { 129 LIST_ENTRY Link; 130 UINT32 Signature; 131 FRAMEWORK_EFI_HII_HANDLE FwHiiHandle; 132 EFI_HII_HANDLE UefiHiiHandle; 133 EFI_HANDLE UefiHiiDriverHandle; 134 135 UINTN IfrPackageCount; 136 UINTN StringPackageCount; 137 138 BOOLEAN ByFrameworkHiiNewPack; 139 140 // 141 // HII Thunk will use TagGuid to associate the String Package and Form Package togehter. 142 // See description for TagGuid. This field is to record if either one of the following condition 143 // is TRUE: 144 // 1) if ((SharingStringPack == TRUE) && (StringPackageCount != 0 && IfrPackageCount == 0)), then this Package List only 145 /// has String Packages and provides Strings to other IFR package. 146 // 2) if ((SharingStringPack == TRUE) && (StringPackageCount == 0 && IfrPackageCount != 1)), then this Form Package 147 // copied String Packages from other Package List. 148 // 3) if ((SharingStringPack == FALSE)), this Package does not provide String Package or copy String Packages from other 149 // Package List. 150 // 151 // 152 // When a Hii->NewString() is called for this FwHiiHandle and SharingStringPack is TRUE, then all Package List that sharing 153 // the same TagGuid will update or create String in there respective String Packages. If SharingStringPack is FALSE, then 154 // only the String from String Packages in this Package List will be updated or created. 155 // 156 BOOLEAN SharingStringPack; 157 158 // 159 // The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption 160 // in both HII Database implementation and all modules that registering packages: 161 // If a Package List has only IFR package and no String Package, the IFR package will reference 162 // String in another Package List registered with the HII database with the same EFI_HII_PACKAGES.GuidId. 163 // TagGuid is the used to record this GuidId. 164 EFI_GUID TagGuid; 165 166 UINT8 *NvMapOverride; 167 168 FORM_BROWSER_FORMSET *FormSet; 169 170 } HII_THUNK_CONTEXT; 171 172 173 174 #define BUFFER_STORAGE_ENTRY_SIGNATURE SIGNATURE_32 ('H', 'T', 's', 'k') 175 #define BUFFER_STORAGE_ENTRY_FROM_LINK(Record) CR(Record, BUFFER_STORAGE_ENTRY, Link, BUFFER_STORAGE_ENTRY_SIGNATURE) 176 typedef struct { 177 LIST_ENTRY Link; 178 UINT32 Signature; 179 EFI_GUID Guid; 180 CHAR16 *Name; 181 UINTN Size; 182 UINT16 VarStoreId; 183 } BUFFER_STORAGE_ENTRY; 184 185 #pragma pack(1) 186 /// 187 /// HII specific Vendor Device Path Node definition. 188 /// 189 typedef struct { 190 VENDOR_DEVICE_PATH VendorDevicePath; 191 UINT32 Reserved; 192 UINT64 UniqueId; 193 } HII_VENDOR_DEVICE_PATH_NODE; 194 195 /// 196 /// HII specific Vendor Device Path definition. 197 /// 198 typedef struct { 199 HII_VENDOR_DEVICE_PATH_NODE Node; 200 EFI_DEVICE_PATH_PROTOCOL End; 201 } HII_VENDOR_DEVICE_PATH; 202 #pragma pack() 203 204 #define CONFIG_ACCESS_PRIVATE_SIGNATURE SIGNATURE_32 ('H', 'T', 'c', 'a') 205 #define CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL(Record) CR(Record, CONFIG_ACCESS_PRIVATE, ConfigAccessProtocol, CONFIG_ACCESS_PRIVATE_SIGNATURE) 206 typedef struct { 207 UINT32 Signature; 208 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccessProtocol; 209 // 210 // Framework's callback 211 // 212 EFI_FORM_CALLBACK_PROTOCOL *FormCallbackProtocol; 213 214 HII_THUNK_CONTEXT *ThunkContext; 215 } CONFIG_ACCESS_PRIVATE; 216 217 218 219 #define EFI_FORMBROWSER_THUNK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('F', 'B', 'T', 'd') 220 #define EFI_FORMBROWSER_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, EFI_FORMBROWSER_THUNK_PRIVATE_DATA, FormBrowser, EFI_FORMBROWSER_THUNK_PRIVATE_DATA_SIGNATURE) 221 typedef struct { 222 UINTN Signature; 223 EFI_HANDLE Handle; 224 HII_THUNK_PRIVATE_DATA *ThunkPrivate; 225 EFI_FORM_BROWSER_PROTOCOL FormBrowser; 226 } EFI_FORMBROWSER_THUNK_PRIVATE_DATA; 227 228 229 // 230 // Extern Variables 231 // 232 extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabase; 233 extern CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol; 234 extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol; 235 extern CONST EFI_HII_FONT_PROTOCOL *mHiiFontProtocol; 236 extern CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol; 237 extern CONST EFI_FORM_BROWSER2_PROTOCOL *mFormBrowser2Protocol; 238 239 extern HII_THUNK_PRIVATE_DATA *mHiiThunkPrivateData; 240 241 extern BOOLEAN mInFrameworkUpdatePakcage; 242 243 244 /** 245 246 Registers the various packages that are passed in a Package List. 247 248 @param This Pointer of Frameowk HII protocol instance. 249 @param Packages Pointer of HII packages. 250 @param Handle Handle value to be returned. 251 252 @retval EFI_SUCCESS Packages has added to HII database successfully. 253 @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL. 254 255 **/ 256 EFI_STATUS 257 EFIAPI 258 HiiNewPack ( 259 IN EFI_HII_PROTOCOL *This, 260 IN EFI_HII_PACKAGES *Packages, 261 OUT FRAMEWORK_EFI_HII_HANDLE *Handle 262 ); 263 264 /** 265 266 Remove a package from the HII database. 267 268 @param This Pointer of Frameowk HII protocol instance. 269 @param Handle Handle value to be removed. 270 271 @retval EFI_SUCCESS Packages has added to HII database successfully. 272 @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL. 273 274 **/ 275 EFI_STATUS 276 EFIAPI 277 HiiRemovePack ( 278 IN EFI_HII_PROTOCOL *This, 279 IN FRAMEWORK_EFI_HII_HANDLE Handle 280 ); 281 282 /** 283 Determines the handles that are currently active in the database. 284 285 This function determines the handles that are currently active in the database. 286 For example, a program wishing to create a Setup-like configuration utility would use this call 287 to determine the handles that are available. It would then use calls defined in the forms section 288 below to extract forms and then interpret them. 289 290 @param This A pointer to the EFI_HII_PROTOCOL instance. 291 @param HandleBufferLength On input, a pointer to the length of the handle buffer. 292 On output, the length of the handle buffer that is required for the handles found. 293 @param Handle Pointer to an array of EFI_HII_HANDLE instances returned. 294 Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() in the Packages section. 295 296 @retval EFI_SUCCESS Handle was updated successfully. 297 298 @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates that Handle is too small 299 to support the number of handles. HandleBufferLength is updated with a value that 300 will enable the data to fit. 301 **/ 302 EFI_STATUS 303 EFIAPI 304 HiiFindHandles ( 305 IN EFI_HII_PROTOCOL *This, 306 IN OUT UINT16 *HandleBufferLength, 307 OUT FRAMEWORK_EFI_HII_HANDLE *Handle 308 ); 309 310 /** 311 312 This thunk module only handles UEFI HII packages. The caller of this function 313 won't be able to parse the content. Therefore, it is not supported. 314 315 This function will ASSERT and return EFI_UNSUPPORTED. 316 317 @param This N.A. 318 @param Handle N.A. 319 @param BufferSize N.A. 320 @param Buffer N.A. 321 322 @retval EFI_UNSUPPORTED 323 324 **/ 325 EFI_STATUS 326 EFIAPI 327 HiiExportDatabase ( 328 IN EFI_HII_PROTOCOL *This, 329 IN FRAMEWORK_EFI_HII_HANDLE Handle, 330 IN OUT UINTN *BufferSize, 331 OUT VOID *Buffer 332 ); 333 334 /** 335 Translates a Unicode character into the corresponding font glyph. 336 337 Notes: 338 This function is only called by Graphics Console module and GraphicsLib. 339 Wrap the Framework HII GetGlyph function to UEFI Font Protocol. 340 341 EDK II provides a UEFI Graphics Console module. ECP provides a GraphicsLib 342 complying to UEFI HII. 343 344 @param This A pointer to the EFI_HII_PROTOCOL instance. 345 @param Source A pointer to a Unicode string. 346 @param Index On input, the offset into the string from which to fetch the character. On successful completion, the 347 index is updated to the first character past the character(s) making up the just extracted glyph. 348 @param GlyphBuffer Pointer to an array where the glyphs corresponding to the characters in the source may be stored. 349 GlyphBuffer is assumed to be wide enough to accept a wide glyph character. 350 @param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by this value is filled with the length of the glyph in pixels. 351 It is unchanged if the call was unsuccessful. 352 @param InternalStatus To save the time required to read the string from the beginning on each glyph extraction 353 (for example, to ensure that the narrow versus wide glyph mode is correct), this value is 354 updated each time the function is called with the status that is local to the call. The cell pointed 355 to by this parameter must be initialized to zero prior to invoking the call the first time for any string. 356 357 @retval EFI_SUCCESS It worked. 358 @retval EFI_NOT_FOUND A glyph for a character was not found. 359 360 361 **/ 362 EFI_STATUS 363 EFIAPI 364 HiiGetGlyph ( 365 IN EFI_HII_PROTOCOL *This, 366 IN CHAR16 *Source, 367 IN OUT UINT16 *Index, 368 OUT UINT8 **GlyphBuffer, 369 OUT UINT16 *BitWidth, 370 IN OUT UINT32 *InternalStatus 371 ); 372 373 /** 374 Translates a glyph into the format required for input to the Universal Graphics Adapter (UGA) Block Transfer (BLT) routines. 375 376 Notes: 377 This function is only called by Graphics Console module and GraphicsLib. 378 EDK II provides a UEFI Graphics Console module. ECP provides a GraphicsLib 379 complying to UEFI HII. 380 381 @param This A pointer to the EFI_HII_PROTOCOL instance. 382 @param GlyphBuffer A pointer to the buffer that contains glyph data. 383 @param Foreground The foreground setting requested to be used for the generated BltBuffer data. Type EFI_UGA_PIXEL is defined in "Related Definitions" below. 384 @param Background The background setting requested to be used for the generated BltBuffer data. 385 @param Count The entry in the BltBuffer upon which to act. 386 @param Width The width in bits of the glyph being converted. 387 @param Height The height in bits of the glyph being converted 388 @param BltBuffer A pointer to the buffer that contains the data that is ready to be used by the UGA BLT routines. 389 390 @retval EFI_SUCCESS It worked. 391 @retval EFI_NOT_FOUND A glyph for a character was not found. 392 393 394 **/ 395 EFI_STATUS 396 EFIAPI 397 HiiGlyphToBlt ( 398 IN EFI_HII_PROTOCOL *This, 399 IN UINT8 *GlyphBuffer, 400 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground, 401 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background, 402 IN UINTN Count, 403 IN UINTN Width, 404 IN UINTN Height, 405 IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer 406 ); 407 408 /** 409 Create or update a String Token in a String Package. 410 411 If *Reference == 0, a new String Token is created. 412 413 @param This A pointer to the EFI_HII_PROTOCOL instance. 414 @param Language Pointer to a NULL-terminated string containing a single ISO 639-2 language 415 identifier, indicating the language to print. A string consisting of 416 all spaces indicates that the string is applicable to all languages. 417 @param Handle The handle of the language pack to which the string is to be added. 418 @param Reference The string token assigned to the string. 419 @param NewString The string to be added. 420 421 422 @retval EFI_SUCCESS The string was effectively registered. 423 @retval EFI_INVALID_PARAMETER The Handle was unknown. The string is not created or updated in the 424 the string package. 425 **/ 426 EFI_STATUS 427 EFIAPI 428 HiiNewString ( 429 IN EFI_HII_PROTOCOL *This, 430 IN CHAR16 *Language, 431 IN FRAMEWORK_EFI_HII_HANDLE Handle, 432 IN OUT STRING_REF *Reference, 433 IN CHAR16 *NewString 434 ); 435 436 /** 437 This function extracts a string from a package already registered with the EFI HII database. 438 439 @param This A pointer to the EFI_HII_PROTOCOL instance. 440 @param Handle The HII handle on which the string resides. 441 @param Token The string token assigned to the string. 442 @param Raw If TRUE, the string is returned unedited in the internal storage format described 443 above. If false, the string returned is edited by replacing <cr> with <space> 444 and by removing special characters such as the <wide> prefix. 445 @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language 446 identifier, indicating the language to print. If the LanguageString is empty (starts 447 with a NULL), the default system language will be used to determine the language. 448 @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too 449 small, this parameter is filled with the length of the buffer needed. 450 @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is 451 defined in String. 452 453 @retval EFI_INVALID_PARAMETER If input parameter is invalid. 454 @retval EFI_BUFFER_TOO_SMALL If the *BufferLength is too small. 455 @retval EFI_SUCCESS Operation is successful. 456 457 **/ 458 EFI_STATUS 459 EFIAPI 460 HiiThunkGetString ( 461 IN EFI_HII_PROTOCOL *This, 462 IN FRAMEWORK_EFI_HII_HANDLE Handle, 463 IN STRING_REF Token, 464 IN BOOLEAN Raw, 465 IN CHAR16 *LanguageString, 466 IN OUT UINTN *BufferLength, 467 OUT EFI_STRING StringBuffer 468 ); 469 470 /** 471 This function removes any new strings that were added after the initial string export for this handle. 472 UEFI HII String Protocol does not have Reset String function. This function perform nothing. 473 474 @param This A pointer to the EFI_HII_PROTOCOL instance. 475 @param Handle The HII handle on which the string resides. 476 477 @retval EFI_SUCCESS This function is a NOP and always return EFI_SUCCESS. 478 479 **/ 480 EFI_STATUS 481 EFIAPI 482 HiiResetStrings ( 483 IN EFI_HII_PROTOCOL *This, 484 IN FRAMEWORK_EFI_HII_HANDLE Handle 485 ); 486 487 /** 488 Test if all of the characters in a string have corresponding font characters. 489 490 This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and 491 return EFI_UNSUPPORTED. 492 493 @param This A pointer to the EFI_HII_PROTOCOL instance. 494 @param StringToTest A pointer to a Unicode string. 495 @param FirstMissing A pointer to an index into the string. On input, the index of 496 the first character in the StringToTest to examine. On exit, the index 497 of the first character encountered for which a glyph is unavailable. 498 If all glyphs in the string are available, the index is the index of the terminator 499 of the string. 500 @param GlyphBufferSize A pointer to a value. On output, if the function returns EFI_SUCCESS, 501 it contains the amount of memory that is required to store the string? glyph equivalent. 502 503 @retval EFI_UNSUPPORTED The function performs nothing and return EFI_UNSUPPORTED. 504 **/ 505 EFI_STATUS 506 EFIAPI 507 HiiTestString ( 508 IN EFI_HII_PROTOCOL *This, 509 IN CHAR16 *StringToTest, 510 IN OUT UINT32 *FirstMissing, 511 OUT UINT32 *GlyphBufferSize 512 ); 513 514 /** 515 Allows a program to determine the primary languages that are supported on a given handle. 516 517 This routine is intended to be used by drivers to query the interface database for supported languages. 518 This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle. 519 520 @param This A pointer to the EFI_HII_PROTOCOL instance. 521 @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() 522 in the Packages section. 523 @param LanguageString A string allocated by GetPrimaryLanguages() that contains a list of all primary languages 524 registered on the handle. The routine will not return the three-spaces language identifier used in 525 other functions to indicate non-language-specific strings. 526 527 @retval EFI_SUCCESS LanguageString was correctly returned. 528 529 @retval EFI_INVALID_PARAMETER The Handle was unknown. 530 **/ 531 EFI_STATUS 532 EFIAPI 533 HiiGetPrimaryLanguages ( 534 IN EFI_HII_PROTOCOL *This, 535 IN FRAMEWORK_EFI_HII_HANDLE Handle, 536 OUT EFI_STRING *LanguageString 537 ); 538 539 /** 540 Allows a program to determine which secondary languages are supported on a given handle for a given primary language 541 542 This routine is intended to be used by drivers to query the interface database for supported languages. 543 This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle. 544 545 @param This A pointer to the EFI_HII_PROTOCOL instance. 546 @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() 547 in the Packages section. 548 @param PrimaryLanguage Pointer to a NULL-terminated string containing a single ISO 639-2 language identifier, indicating 549 the primary language. 550 @param LanguageString A string allocated by GetSecondaryLanguages() containing a list of all secondary languages registered 551 on the handle. The routine will not return the three-spaces language identifier used in other functions 552 to indicate non-language-specific strings, nor will it return the primary language. This function succeeds 553 but returns a NULL LanguageString if there are no secondary languages associated with the input Handle and 554 PrimaryLanguage pair. Type EFI_STRING is defined in String. 555 556 @retval EFI_SUCCESS LanguageString was correctly returned. 557 @retval EFI_INVALID_PARAMETER The Handle was unknown. 558 **/ 559 EFI_STATUS 560 EFIAPI 561 HiiGetSecondaryLanguages ( 562 IN EFI_HII_PROTOCOL *This, 563 IN FRAMEWORK_EFI_HII_HANDLE Handle, 564 IN CHAR16 *PrimaryLanguage, 565 OUT EFI_STRING *LanguageString 566 ); 567 568 /** 569 570 This function allows a program to extract a part of a string of not more than a given width. 571 With repeated calls, this allows a calling program to extract "lines" of text that fit inside 572 columns. The effort of measuring the fit of strings inside columns is localized to this call. 573 574 This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and 575 return EFI_UNSUPPORTED. 576 577 @param This A pointer to the EFI_HII_PROTOCOL instance. 578 @param Handle The HII handle on which the string resides. 579 @param Token The string token assigned to the string. 580 @param Index On input, the offset into the string where the line is to start. 581 On output, the index is updated to point to beyond the last character returned 582 in the call. 583 @param LineWidth The maximum width of the line in units of narrow glyphs. 584 @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language 585 identifier, indicating the language to print. If the LanguageString is empty (starts 586 with a NULL), the default system language will be used to determine the language. 587 @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too 588 small, this parameter is filled with the length of the buffer needed. 589 @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is 590 defined in String. 591 592 @retval EFI_UNSUPPORTED. 593 **/ 594 EFI_STATUS 595 EFIAPI 596 HiiGetLine ( 597 IN EFI_HII_PROTOCOL *This, 598 IN FRAMEWORK_EFI_HII_HANDLE Handle, 599 IN STRING_REF Token, 600 IN OUT UINT16 *Index, 601 IN UINT16 LineWidth, 602 IN CHAR16 *LanguageString, 603 IN OUT UINT16 *BufferLength, 604 OUT EFI_STRING StringBuffer 605 ); 606 607 /** 608 This function allows a program to extract a form or form package that has 609 previously been registered with the EFI HII database. 610 611 In this thunk module, this function will create a IFR Package with only 612 one Formset. Effectively, only the GUID of the Formset is updated and return 613 in this IFR package to caller. This is enable the Framework modules which call 614 a API named GetStringFromToken. GetStringFromToken retieves a String based on 615 a String Token from a Package List known only by the Formset GUID. 616 617 618 619 @param This A pointer to the EFI_HII_PROTOCOL instance. 620 @param Handle Handle on which the form resides. Type FRAMEWORK_EFI_HII_HANDLE is defined in 621 EFI_HII_PROTOCOL.NewPack() in the Packages section. 622 @param FormId Ignored by this implementation. 623 @param BufferLengthTemp On input, the size of input buffer. On output, it 624 is the size of FW_HII_FORMSET_TEMPLATE. 625 @param Buffer The buffer designed to receive the form(s). 626 627 @retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength 628 was updated. 629 @retval EFI_INVALID_PARAMETER The handle is unknown. 630 @retval EFI_NOT_FOUND A form on the requested handle cannot be found with the 631 requested FormId. 632 @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to allow the form to be stored. 633 634 **/ 635 EFI_STATUS 636 EFIAPI 637 HiiGetForms ( 638 IN EFI_HII_PROTOCOL *This, 639 IN FRAMEWORK_EFI_HII_HANDLE Handle, 640 IN EFI_FORM_ID FormId, 641 IN OUT UINTN *BufferLengthTemp, 642 OUT UINT8 *Buffer 643 ); 644 645 /** 646 647 This function allows a program to extract the NV Image 648 that represents the default storage image 649 650 651 @param This A pointer to the EFI_HII_PROTOCOL instance. 652 @param Handle The HII handle from which will have default data retrieved. 653 UINTN - Mask used to retrieve the default image. 654 @param DefaultMask EDES_TODO: Add parameter description 655 @param VariablePackList Callee allocated, tightly-packed, link list data 656 structure that contain all default varaible packs 657 from the Hii Database. 658 659 @retval EFI_NOT_FOUND If Hii database does not contain any default images. 660 @retval EFI_INVALID_PARAMETER Invalid input parameter. 661 @retval EFI_SUCCESS Operation successful. 662 663 **/ 664 EFI_STATUS 665 EFIAPI 666 HiiGetDefaultImage ( 667 IN EFI_HII_PROTOCOL *This, 668 IN FRAMEWORK_EFI_HII_HANDLE Handle, 669 IN UINTN DefaultMask, 670 OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList 671 ); 672 673 /** 674 This function allows the caller to update a form that has 675 previously been registered with the EFI HII database. 676 677 678 @param This EDES_TODO: Add parameter description 679 @param Handle Hii Handle associated with the Formset to modify 680 @param Label Update information starting immediately after this label in the IFR 681 @param AddData If TRUE, add data. If FALSE, remove data 682 @param Data If adding data, this is the pointer to the data to add 683 684 @retval EFI_SUCCESS Update success. 685 @retval Other Update fail. 686 687 **/ 688 EFI_STATUS 689 EFIAPI 690 HiiThunkUpdateForm ( 691 IN EFI_HII_PROTOCOL *This, 692 IN FRAMEWORK_EFI_HII_HANDLE Handle, 693 IN EFI_FORM_LABEL Label, 694 IN BOOLEAN AddData, 695 IN EFI_HII_UPDATE_DATA *Data 696 ); 697 698 /** 699 Retrieves the current keyboard layout. 700 This function is not implemented by HII Thunk Module. 701 702 @param This A pointer to the EFI_HII_PROTOCOL instance. 703 @param DescriptorCount A pointer to the number of Descriptor entries being described in the keyboard layout being retrieved. 704 @param Descriptor A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR entries. Each entry will reflect the 705 definition of a specific physical key. Type EFI_KEY_DESCRIPTOR is defined in "Related Definitions" below. 706 707 @retval EFI_SUCCESS The keyboard layout was retrieved successfully. 708 709 **/ 710 EFI_STATUS 711 EFIAPI 712 HiiGetKeyboardLayout ( 713 IN EFI_HII_PROTOCOL *This, 714 OUT UINT16 *DescriptorCount, 715 OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor 716 ); 717 718 /** 719 This is the Framework Setup Browser interface which displays a FormSet. 720 721 @param This The EFI_FORM_BROWSER_PROTOCOL context. 722 @param UseDatabase TRUE if the FormSet is from HII database. The Thunk implementation 723 only support UseDatabase is TRUE. 724 @param Handle The Handle buffer. 725 @param HandleCount The number of Handle in the Handle Buffer. It must be 1 for this implementation. 726 @param Packet The pointer to data buffer containing IFR and String package. Not supported. 727 @param CallbackHandle Not supported. 728 @param NvMapOverride The buffer is used only when there is no NV variable to define the 729 current settings and the caller needs to provide to the browser the 730 current settings for the the "fake" NV variable. If used, no saving of 731 an NV variable is possbile. This parameter is also ignored if Handle is NULL. 732 @param ScreenDimensions 733 Allows the browser to be called so that it occupies a portion of the physical 734 screen instead of dynamically determining the screen dimensions. 735 @param ResetRequired This BOOLEAN value denotes whether a reset is required based on the data that 736 might have been changed. The ResetRequired parameter is primarily applicable 737 for configuration applications, and is an optional parameter. 738 739 @retval EFI_SUCCESS If the Formset is displayed correctly. 740 @retval EFI_UNSUPPORTED If UseDatabase is FALSE or HandleCount is not 1. 741 @retval EFI_INVALID_PARAMETER If the *Handle passed in is not found in the database. 742 **/ 743 EFI_STATUS 744 EFIAPI 745 ThunkSendForm ( 746 IN EFI_FORM_BROWSER_PROTOCOL *This, 747 IN BOOLEAN UseDatabase, 748 IN FRAMEWORK_EFI_HII_HANDLE *Handle, 749 IN UINTN HandleCount, 750 IN EFI_IFR_PACKET *Packet, OPTIONAL 751 IN EFI_HANDLE CallbackHandle, OPTIONAL 752 IN UINT8 *NvMapOverride, OPTIONAL 753 IN FRAMEWORK_EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL 754 OUT BOOLEAN *ResetRequired OPTIONAL 755 ); 756 757 /** 758 759 Rountine used to display a generic dialog interface and return 760 the Key or Input from user input. 761 762 @param LinesNumber The number of lines for the dialog box. 763 @param HotKey Defines if a single character is parsed (TRUE) and returned in KeyValue 764 or if a string is returned in StringBuffer. 765 @param MaximumStringSize The maximum size in bytes of a typed-in string. 766 @param StringBuffer On return contains the typed-in string if HotKey is FALSE. 767 @param Key The EFI_INPUT_KEY value returned if HotKey is TRUE. 768 @param FirstString The pointer to the first string in the list of strings 769 that comprise the dialog box. 770 @param ... A series of NumberOfLines text strings that will be used 771 to construct the dialog box. 772 @retval EFI_SUCCESS The dialog is created successfully and user interaction was received. 773 @retval EFI_DEVICE_ERROR The user typed in an ESC. 774 @retval EFI_INVALID_PARAMETER One of the parameters was invalid.(StringBuffer == NULL && HotKey == FALSE). 775 **/ 776 EFI_STATUS 777 EFIAPI 778 ThunkCreatePopUp ( 779 IN UINTN LinesNumber, 780 IN BOOLEAN HotKey, 781 IN UINTN MaximumStringSize, 782 OUT CHAR16 *StringBuffer, 783 OUT EFI_INPUT_KEY *Key, 784 IN CHAR16 *FirstString, 785 ... 786 ); 787 788 /** 789 This notification function will be called when a Package List is removed 790 using UEFI HII interface. The Package List removed need to be removed from 791 Framework Thunk module too. 792 793 If the Package List registered is not Sting Package, 794 then ASSERT. If the NotifyType is not REMOVE_PACK, then ASSERT. 795 Both cases means UEFI HII Database itself is buggy. 796 797 @param PackageType The Package Type. 798 @param PackageGuid The Package GUID. 799 @param Package The Package Header. 800 @param Handle The HII Handle of this Package List. 801 @param NotifyType The reason of the notification. 802 803 @retval EFI_SUCCESS The notification function is successful. 804 805 **/ 806 EFI_STATUS 807 EFIAPI 808 RemovePackNotify ( 809 IN UINT8 PackageType, 810 IN CONST EFI_GUID *PackageGuid, 811 IN CONST EFI_HII_PACKAGE_HEADER *Package, 812 IN EFI_HII_HANDLE Handle, 813 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType 814 ); 815 816 /** 817 This notification function will be called when a Package List is registered 818 using UEFI HII interface. The Package List registered need to be recorded in 819 Framework Thunk module as Thunk Module may need to look for String Package in 820 the package registered. 821 822 If the Package List registered is not either Sting Package or IFR package, 823 then ASSERT. If the NotifyType is not ADD_PACK or NEW_PACK, then ASSERT. 824 Both cases means UEFI HII Database itself is buggy. 825 826 @param PackageType The Package Type. 827 @param PackageGuid The Package GUID. 828 @param Package The Package Header. 829 @param Handle The HII Handle of this Package List. 830 @param NotifyType The reason of the notification. 831 832 @retval EFI_SUCCESS The notification function is successful. 833 834 **/ 835 EFI_STATUS 836 EFIAPI 837 NewOrAddPackNotify ( 838 IN UINT8 PackageType, 839 IN CONST EFI_GUID *PackageGuid, 840 IN CONST EFI_HII_PACKAGE_HEADER *Package, 841 IN EFI_HII_HANDLE Handle, 842 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType 843 ); 844 845 /** 846 Create a Hii Update data Handle used to call IfrLibUpdateForm. 847 848 @param ThunkContext The HII Thunk Context. 849 @param FwUpdateData The Framework Update Data. 850 @param UefiOpCodeHandle The UEFI Update Data. 851 852 @retval EFI_SUCCESS The UEFI Update Data is created successfully. 853 @retval EFI_UNSUPPORTED There is unsupported opcode in FwUpdateData. 854 @retval EFI_OUT_OF_RESOURCES There is not enough resource. 855 **/ 856 EFI_STATUS 857 FwUpdateDataToUefiUpdateData ( 858 IN HII_THUNK_CONTEXT *ThunkContext, 859 IN CONST EFI_HII_UPDATE_DATA *FwUpdateData, 860 IN VOID *UefiOpCodeHandle 861 ) 862 ; 863 864 /** 865 866 Initialize string packages in HII database. 867 868 **/ 869 VOID 870 InitSetBrowserStrings ( 871 VOID 872 ) 873 ; 874 875 /** 876 Convert language code from RFC4646 to ISO639-2. 877 878 LanguageRfc4646 contain a single RFC 4646 code such as 879 "en-US" or "fr-FR". 880 881 The LanguageRfc4646 must be a buffer large enough 882 for ISO_639_2_ENTRY_SIZE characters. 883 884 If LanguageRfc4646 is NULL, then ASSERT. 885 If LanguageIso639 is NULL, then ASSERT. 886 887 @param LanguageRfc4646 RFC4646 language code. 888 @param LanguageIso639 ISO639-2 language code. 889 890 @retval EFI_SUCCESS Language code converted. 891 @retval EFI_NOT_FOUND Language code not found. 892 893 **/ 894 EFI_STATUS 895 EFIAPI 896 ConvertRfc4646LanguageToIso639Language ( 897 IN CHAR8 *LanguageRfc4646, 898 OUT CHAR8 *LanguageIso639 899 ) 900 ; 901 902 /** 903 Convert language code from ISO639-2 to RFC4646 and return the converted language. 904 Caller is responsible for freeing the allocated buffer. 905 906 LanguageIso639 contain a single ISO639-2 code such as 907 "eng" or "fra". 908 909 If LanguageIso639 is NULL, then ASSERT. 910 If LanguageRfc4646 is NULL, then ASSERT. 911 912 @param LanguageIso639 ISO639-2 language code. 913 914 @return the allocated buffer or NULL, if the language is not found. 915 916 **/ 917 CHAR8* 918 EFIAPI 919 ConvertIso639LanguageToRfc4646Language ( 920 IN CONST CHAR8 *LanguageIso639 921 ) 922 ; 923 924 /** 925 Get next language from language code list (with separator ';'). 926 927 If LangCode is NULL, then ASSERT. 928 If Lang is NULL, then ASSERT. 929 930 @param LangCode On input: point to first language in the list. On 931 output: point to next language in the list, or 932 NULL if no more language in the list. 933 @param Lang The first language in the list. 934 935 **/ 936 VOID 937 EFIAPI 938 GetNextLanguage ( 939 IN OUT CHAR8 **LangCode, 940 OUT CHAR8 *Lang 941 ) 942 ; 943 944 #include "Utility.h" 945 #include "ConfigAccess.h" 946 947 #endif 948