1 /** @file 2 This file defines the Human Interface Infrastructure protocol, which is 3 used by resources that want to publish IFR/Font/String data and have it 4 collected by the Configuration engine. 5 6 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> 7 SPDX-License-Identifier: BSD-2-Clause-Patent 8 9 @par Revision Reference: 10 This protocol is defined in Framework for EFI Human Interface Infrastructure 11 Specification Version 0.92. 12 13 **/ 14 15 #ifndef _FRAMEWORK_HII_H_ 16 #define _FRAMEWORK_HII_H_ 17 18 // 19 // EFI_GRAPHICS_OUTPUT_BLT_PIXEL is defined in MdePkg/Protocol/GraphicsOutput.h 20 // 21 #include <Protocol/GraphicsOutput.h> 22 /// 23 /// In both EDK and EDK II, there is an incompatbile change in the Framework HII protocol. 24 /// This change should cause a change of GUID in both of code and HII specification. But we 25 /// updated the GUID in code in EDK and EDK II. The 0.92 specification is not updated. This 26 /// is a known issue. 27 /// 28 /// 29 /// Note that EFI_HII_PROTOCOL_GUID is different from that defined in the Framework HII 30 /// 0.92 specification because the specification changed part of HII interfaces but did not update the protocol 31 /// GUID. 32 /// 33 #define EFI_HII_PROTOCOL_GUID \ 34 { \ 35 0xd7ad636e, 0xb997, 0x459b, {0xbf, 0x3f, 0x88, 0x46, 0x89, 0x79, 0x80, 0xe1} \ 36 } 37 38 #define EFI_HII_COMPATIBILITY_PROTOCOL_GUID \ 39 { \ 40 0x5542cce1, 0xdf5c, 0x4d1b, { 0xab, 0xca, 0x36, 0x4f, 0x77, 0xd3, 0x99, 0xfb } \ 41 } 42 43 typedef UINT32 RELOFST; 44 45 typedef struct _EFI_HII_PROTOCOL EFI_HII_PROTOCOL; 46 47 /// 48 /// Note: Name difference between code and the Framework HII 0.92 specificaiton. 49 /// Add FRAMEWORK_ prefix to avoid a name confict with EFI_HII_HANDLE, defined in the 50 /// UEFI 2.1d specification. 51 /// 52 typedef UINT16 FRAMEWORK_EFI_HII_HANDLE; 53 54 /// 55 /// HII package type values 56 /// 57 #define EFI_HII_FONT 1 58 #define EFI_HII_STRING 2 59 #define EFI_HII_IFR 3 60 #define EFI_HII_KEYBOARD 4 61 #define EFI_HII_HANDLES 5 62 #define EFI_HII_VARIABLE 6 63 #define EFI_HII_DEVICE_PATH 7 64 65 // 66 // References to string tokens must use this macro to enable scanning for 67 // token usages. 68 // 69 #define STRING_TOKEN(t) t 70 71 // 72 // The following types are currently defined: 73 // EFI_FORM_ID has been defined in UEFI spec. 74 // 75 typedef UINT16 EFI_FORM_LABEL; 76 77 #pragma pack(1) 78 79 /// 80 /// The header found at the start of each package. 81 /// 82 typedef struct { 83 UINT32 Length; ///< The size of the package in bytes. 84 UINT16 Type; ///< The type of the package. 85 } EFI_HII_PACK_HEADER; 86 87 /// 88 /// The IFR package structure. 89 /// Immediately following the EFI_HII_IFR_PACK structure will be a series of IFR opcodes. 90 /// 91 typedef struct { 92 EFI_HII_PACK_HEADER Header; ///< Header of the IFR package. 93 } EFI_HII_IFR_PACK; 94 95 /// 96 /// HII Handle package structure. 97 /// 98 typedef struct { 99 /// 100 /// Header of the package. 101 /// 102 EFI_HII_PACK_HEADER Header; ///< Must be filled in. 103 /// 104 /// The image handle of the driver to which the package is referring. 105 /// 106 EFI_HANDLE ImageHandle; ///< Must be filled in. 107 /// 108 /// The handle of the device that is being described by this package. 109 /// 110 EFI_HANDLE DeviceHandle; ///< Optional. 111 /// 112 /// The handle of the parent of the device that is being described by this package. 113 /// 114 EFI_HANDLE ControllerHandle; ///< Optional. 115 /// 116 /// The handle that was registered to receive EFI_FORM_CALLBACK_PROTOCOL calls from other drivers. 117 /// 118 EFI_HANDLE CallbackHandle; ///< Optional. 119 /// 120 /// Note this field is not defined in the Framework HII 0.92 specificaiton. 121 /// Unused. Reserved for source code compatibility. 122 /// 123 EFI_HANDLE COBExportHandle; ///< Optional. 124 } EFI_HII_HANDLE_PACK; 125 126 /// 127 /// The variable package structure. 128 /// 129 typedef struct { 130 /// 131 /// The header of the package. 132 /// 133 EFI_HII_PACK_HEADER Header; 134 /// 135 /// The GUID of the EFI variable. 136 /// 137 EFI_GUID VariableGuid; 138 /// 139 /// The length in bytes of the EFI variable. 140 /// 141 UINT32 VariableNameLength; 142 /// 143 /// The unique value for this variable. 144 /// 145 UINT16 VariableId; 146 // 147 // CHAR16 VariableName[]; //Null-terminated 148 // 149 } EFI_HII_VARIABLE_PACK; 150 151 /// 152 /// The device path package structure. 153 /// 154 typedef struct { 155 /// 156 /// The header of the package. 157 /// 158 EFI_HII_PACK_HEADER Header; 159 // 160 // EFI_DEVICE_PATH DevicePath[]; 161 // 162 } EFI_HII_DEVICE_PATH_PACK; 163 164 typedef struct { 165 /// 166 /// A unique value that correlates to the original HII handle. 167 /// 168 FRAMEWORK_EFI_HII_HANDLE HiiHandle; 169 /// 170 /// If an IFR pack exists in a data table that does not contain strings, 171 /// then the strings for that IFR pack are located in another data table 172 /// that contains a string pack and has a matching HiiDataTable.PackageGuid. 173 /// 174 EFI_GUID PackageGuid; 175 /// 176 /// The size of the EFI_HII_DATA_TABLE in bytes. 177 /// 178 UINT32 DataTableSize; 179 /// 180 /// The byte offset from the start of this structure to the IFR data. 181 /// If the offset value is 0, then no IFR data is enclosed. 182 /// 183 UINT32 IfrDataOffset; 184 /// 185 /// The byte offset from the start of this structure to the string data. 186 /// If the offset value is 0, then no string data is enclosed. 187 /// 188 UINT32 StringDataOffset; 189 /// 190 /// The byte offset from the start of this structure to the variable data. 191 /// If the offset value is 0, then no variable data is enclosed. 192 /// 193 UINT32 VariableDataOffset; 194 /// 195 /// The byte offset from the start of this structure to the device path data. 196 /// If the offset value is 0, then no DevicePath data is enclosed. 197 /// 198 UINT32 DevicePathOffset; 199 /// 200 /// The number of VariableData[] elements in the array. 201 /// 202 UINT32 NumberOfVariableData; 203 /// 204 /// The number of language string packages. 205 /// 206 UINT32 NumberOfLanguages; 207 // 208 // EFI_HII_DEVICE_PATH_PACK DevicePath[]; 209 // EFI_HII_VARIABLE_PACK VariableData[]; 210 // EFI_HII_IFR_PACK IfrData; 211 // EFI_HII_STRING_PACK StringData[]; 212 // 213 } EFI_HII_DATA_TABLE; 214 215 /// 216 /// The structure defining the format for exporting data from the HII Database. 217 /// 218 typedef struct { 219 /// 220 /// Number of EFI_HII_DATA_TABLE entries. 221 /// 222 UINT32 NumberOfHiiDataTables; 223 /// 224 /// Defines the revision of the EFI_HII_DATA_TABLE structure. 225 /// 226 EFI_GUID Revision; 227 // 228 // EFI_HII_DATA_TABLE HiiDataTable[]; 229 // 230 } EFI_HII_EXPORT_TABLE; 231 232 /// 233 /// The structure used to pass data to update a form or form package 234 /// that has previously been registered with the EFI HII database. 235 /// 236 typedef struct { 237 /// 238 /// If TRUE, indicates that the FormCallbackHandle value will 239 /// be used to update the contents of the CallBackHandle entry in the form set. 240 /// 241 BOOLEAN FormSetUpdate; 242 /// 243 /// This parameter is valid only when FormSetUpdate is TRUE. 244 /// The value in this parameter will be used to update the contents 245 /// of the CallbackHandle entry in the form set. 246 /// 247 EFI_PHYSICAL_ADDRESS FormCallbackHandle; 248 /// 249 /// If TRUE, indicates that the FormTitle contents will be 250 /// used to update the FormValue's title. 251 /// 252 BOOLEAN FormUpdate; 253 /// 254 /// Specifies which form is to be updated if the FormUpdate value is TRUE. 255 /// 256 UINT16 FormValue; 257 /// 258 /// This parameter is valid only when the FormUpdate parameter is TRUE. 259 /// The value in this parameter will be used to update the contents of the form title. 260 /// 261 STRING_REF FormTitle; 262 /// 263 /// The number of Data entries in this structure. 264 UINT16 DataCount; 265 /// 266 /// An array of 1+ opcodes, specified by DataCount. 267 /// 268 UINT8 *Data; 269 } EFI_HII_UPDATE_DATA; 270 271 // 272 // String attributes 273 // 274 #define LANG_RIGHT_TO_LEFT 0x00000001 275 276 /// 277 /// A string package is used to localize strings to a particular 278 /// language. The package is associated with a particular driver 279 /// or set of drivers. Tools are used to associate tokens with 280 /// string references in forms and in programs. These tokens are 281 /// language agnostic. When paired with a language pack (directly 282 /// or indirectly), the string token resolves into an actual 283 /// UNICODE string. NumStringPointers determines how many 284 /// StringPointers (offset values) there are, as well as the total 285 /// number of Strings that are defined. 286 /// 287 typedef struct { 288 /// 289 /// The header of the package. 290 /// 291 EFI_HII_PACK_HEADER Header; 292 /// 293 /// The string containing one or more ISO 639-2 three-character designator(s) 294 /// of the language or languages whose translations are contained in this language pack. 295 /// The first designator indicates the primary language, while the others are secondary languages. 296 /// 297 RELOFST LanguageNameString; 298 /// 299 /// Contains the offset into this structure of a printable name of the language 300 /// for use when prompting the user. The language printed is to be the primary language. 301 /// 302 RELOFST PrintableLanguageName; 303 /// 304 /// The number of Strings and StringPointers contained within the string package. 305 /// 306 UINT32 NumStringPointers; 307 /// 308 /// Indicates the direction the language is to be printed. 309 /// 310 UINT32 Attributes; 311 // 312 // RELOFST StringPointers[]; 313 // EFI_STRING Strings[]; 314 // 315 } EFI_HII_STRING_PACK; 316 317 318 /// 319 /// A font list consists of a font header followed by a series 320 /// of glyph structures. Note that fonts are not language specific. 321 /// 322 typedef struct { 323 /// 324 /// The header of the package. 325 /// 326 EFI_HII_PACK_HEADER Header; 327 /// 328 /// The number of NarrowGlyphs that are included in the font package. 329 /// 330 UINT16 NumberOfNarrowGlyphs; 331 /// 332 /// The number of WideGlyphs that are included in the font package. 333 /// 334 UINT16 NumberOfWideGlyphs; 335 //EFI_NARROW_GLYPH NarrowGlyphs[]; 336 //EFI_WIDE_GLYPH WideGlyphs[]; 337 } EFI_HII_FONT_PACK; 338 339 /// 340 /// The definition of a specific physical key 341 /// 342 /// Note: The name difference between code and the Framework HII 0.92 specification. 343 /// Add FRAMEWORK_ prefix to avoid name confict with EFI_KEY_DESCRIPTOR defined in the 344 /// UEFI 2.1d specification. 345 /// 346 typedef struct { 347 /// 348 /// Used to describe a physical key on a keyboard. 349 /// 350 EFI_KEY Key; 351 /// 352 /// The Unicode value for the Key. 353 CHAR16 Unicode; 354 /// 355 /// The Unicode value for the key with the shift key being held down. 356 /// 357 CHAR16 ShiftedUnicode; 358 /// 359 /// The Unicode value for the key with the Alt-GR being held down. 360 /// 361 CHAR16 AltGrUnicode; 362 /// 363 /// The Unicode value for the key with the Alt-GR and shift keys being held down. 364 /// 365 CHAR16 ShiftedAltGrUnicode; 366 /// 367 /// Modifier keys are defined to allow for special functionality that 368 /// is not necessarily accomplished by a printable character. 369 /// 370 UINT16 Modifier; 371 } FRAMEWORK_EFI_KEY_DESCRIPTOR; 372 373 /// 374 /// This structure allows a sparse set of keys to be redefined 375 /// or a complete redefinition of the keyboard layout. Most 376 /// keyboards have a lot of commonality in their layouts, therefore 377 /// only defining those keys that need to change from the default 378 /// minimizes the passed in information. 379 /// 380 /// Additionally, when an update occurs, the active keyboard layout 381 /// will be switched to the newly updated keyboard layout. This 382 /// allows for situations that when a keyboard layout driver is 383 /// loaded as part of system initialization, the system will default 384 /// the keyboard behavior to the new layout. 385 /// 386 typedef struct { 387 /// 388 /// The header of the package. 389 EFI_HII_PACK_HEADER Header; 390 /// 391 /// A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR entries. 392 /// Each entry will reflect the definition of a specific physical key. 393 /// 394 FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor; 395 /// 396 /// The number of Descriptor entries being described. 397 /// 398 UINT8 DescriptorCount; 399 } EFI_HII_KEYBOARD_PACK; 400 401 /// 402 /// The packages structure that will be used to pass contents into the HII database. 403 /// 404 /// The EFI_HII_PACKAGES can contain various number of packages of different types just 405 /// after the structure as inline data. 406 /// 407 typedef struct { 408 /// 409 /// The number of packages being defined in this structure. 410 /// 411 UINTN NumberOfPackages; 412 /// 413 /// The GUID to be used to identify this set of packages that are being exported 414 /// to the HII database. 415 /// 416 EFI_GUID *GuidId; 417 // 418 // EFI_HII_HANDLE_PACK *HandlePack; // Only one pack. 419 // EFI_HII_IFR_PACK *IfrPack; // Only one pack. 420 // EFI_HII_FONT_PACK *FontPack[]; // Multiple packs ok 421 // EFI_HII_STRING_PACK *StringPack[]; // Multiple packs ok 422 // EFI_HII_KEYBOARD_PACK *KeyboardPack[]; // Multiple packs ok 423 // 424 } EFI_HII_PACKAGES; 425 426 /// 427 /// The packed link list that contains all the discernable defaults of variables 428 /// for the opcodes that are defined in this Handle's domain of data. 429 /// 430 typedef struct _EFI_HII_VARIABLE_PACK_LIST { 431 /// 432 /// A pointer points to the next data structure of type 433 /// EFI_HII_VARIABLE_PACK_LIST in the packed link list. 434 /// 435 struct _EFI_HII_VARIABLE_PACK_LIST *NextVariablePack; 436 /// 437 /// A pointer points to the content of the variable entry defined by GUID/name/data. 438 /// 439 EFI_HII_VARIABLE_PACK *VariablePack; 440 //EFI_HII_VARIABLE_PACK Content 441 } EFI_HII_VARIABLE_PACK_LIST; 442 443 444 #pragma pack() 445 446 /** 447 Registers the various packs that are passed in via the Packages parameter. 448 449 @param This A pointer to the EFI_HII_PROTOCOL instance. 450 @param Packages A pointer to an EFI_HII_PACKAGES package instance. 451 @param Handle A pointer to the FRAMEWORK_EFI_HII_HANDLE instance. 452 453 @retval EFI_SUCCESS Data was extracted from Packages, the database 454 was updated with the data, and Handle returned successfully. 455 @retval EFI_INVALID_PARAMETER The content of Packages was invalid. 456 457 **/ 458 typedef 459 EFI_STATUS 460 (EFIAPI *EFI_HII_NEW_PACK)( 461 IN EFI_HII_PROTOCOL *This, 462 IN EFI_HII_PACKAGES *Packages, 463 OUT FRAMEWORK_EFI_HII_HANDLE *Handle 464 ); 465 466 /** 467 Removes a package from the HII database. 468 469 @param This A pointer to the EFI_HII_PROTOCOL instance. 470 @param Handle The handle that was registered to the data that 471 is requested for removal. 472 473 @retval EFI_SUCCESS The data associated with the Handle was removed 474 from the HII database. 475 @retval EFI_INVALID_PARAMETER The Handle was not valid. 476 477 **/ 478 typedef 479 EFI_STATUS 480 (EFIAPI *EFI_HII_REMOVE_PACK)( 481 IN EFI_HII_PROTOCOL *This, 482 IN FRAMEWORK_EFI_HII_HANDLE Handle 483 ); 484 485 /** 486 Determines the handles that are currently active in the database. 487 488 @param This A pointer to the EFI_HII_PROTOCOL instance. 489 @param HandleBufferLength On input, a pointer to the length of the handle 490 buffer. On output, the length of the handle buffer that is required 491 for the handles found. 492 @param Handle An array of FRAMEWORK_EFI_HII_HANDLE instances returned. 493 494 @retval EFI_SUCCESS Handle was updated successfully. 495 @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates 496 that Handle is too small to support the number of handles. 497 498 **/ 499 typedef 500 EFI_STATUS 501 (EFIAPI *EFI_HII_FIND_HANDLES)( 502 IN EFI_HII_PROTOCOL *This, 503 IN OUT UINT16 *HandleBufferLength, 504 OUT FRAMEWORK_EFI_HII_HANDLE *Handle 505 ); 506 507 /** 508 Exports the contents of the database into a buffer. 509 510 @param This A pointer to the EFI_HII_PROTOCOL instance. 511 @param Handle A FRAMEWORK_EFI_HII_HANDLE that corresponds to the desired 512 handle to export. If the value is 0, the entire database will be exported. 513 The data is exported in a format described by the 514 structure definition of EFI_HII_EXPORT_TABLE. 515 @param BufferSize 516 On input, a pointer to the length of the buffer. On output, the length 517 of the buffer that is required for the export data. 518 @param Buffer A pointer to a buffer that will contain the results of the export function. 519 520 @retval EFI_SUCCESS The buffer was successfully filled with BufferSize amount of data. 521 @retval EFI_BUFFER_TOO_SMALL The value in BufferSize was too small to contain the export data. 522 523 **/ 524 typedef 525 EFI_STATUS 526 (EFIAPI *EFI_HII_EXPORT)( 527 IN EFI_HII_PROTOCOL *This, 528 IN FRAMEWORK_EFI_HII_HANDLE Handle, 529 IN OUT UINTN *BufferSize, 530 OUT VOID *Buffer 531 ); 532 533 /** 534 Remove any new strings that were added after the initial string export 535 for this handle. 536 537 @param This A pointer to the EFI_HII_PROTOCOL instance. 538 @param Handle The handle on which the string resides. 539 540 @retval EFI_SUCCESS Successfully removed strings from the handle. 541 @retval EFI_INVALID_PARAMETER The Handle was unknown. 542 543 **/ 544 typedef 545 EFI_STATUS 546 (EFIAPI *EFI_HII_RESET_STRINGS)( 547 IN EFI_HII_PROTOCOL *This, 548 IN FRAMEWORK_EFI_HII_HANDLE Handle 549 ); 550 551 /** 552 Tests if all of the characters in a string have corresponding font characters. 553 554 @param This A pointer to the EFI_HII_PROTOCOL instance. 555 @param StringToTest A pointer to a Unicode string. 556 @param FirstMissing A pointer to an index into the string. On input, 557 the index of the first character in the StringToTest 558 to examine. On exit, the index of the first character 559 encountered for which a glyph is unavailable. 560 If all glyphs in the string are available, the 561 index is the index of the terminator of the string. 562 @param GlyphBufferSize A pointer to a value. On output, if the function 563 returns EFI_SUCCESS, it contains the amount of 564 memory that is required to store the string's 565 glyph equivalent. 566 567 @retval EFI_SUCCESS All glyphs are available. Note that an empty string 568 always returns this value. 569 @retval EFI_NOT_FOUND A glyph was not found for a character. 570 571 **/ 572 typedef 573 EFI_STATUS 574 (EFIAPI *EFI_HII_TEST_STRING)( 575 IN EFI_HII_PROTOCOL *This, 576 IN CHAR16 *StringToTest, 577 IN OUT UINT32 *FirstMissing, 578 OUT UINT32 *GlyphBufferSize 579 ); 580 581 /** 582 Translates a Unicode character into the corresponding font glyph. 583 584 Note that this function prototype name is different from that in the Framework HII 0.92 specification 585 to avoid name confict with EFI_HII_GET_GLYPH defined in the UEFI 2.1d specification. 586 587 @param This A pointer to the EFI_HII_PROTOCOL instance. 588 @param Source A pointer to a Unicode string. 589 @param Index On input, the offset into the string from which to 590 fetch the character. On successful completion, the 591 index is updated to the first character past the 592 character(s) making up the just extracted glyph. 593 @param GlyphBuffer Pointer to an array where the glyphs corresponding 594 to the characters in the source may be stored. 595 GlyphBuffer is assumed to be wide enough to accept 596 a wide glyph character. 597 @param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by 598 this value is filled with the length of the glyph in 599 pixels. It is unchanged if the call was unsuccessful. 600 @param InternalStatus The cell pointed to by this parameter must be 601 initialized to zero prior to invoking the call the 602 first time for any string. 603 604 @retval EFI_SUCCESS Found the corresponding font glyph for a Unicode 605 character. 606 @retval EFI_NOT_FOUND A glyph for a character was not found. 607 608 **/ 609 typedef 610 EFI_STATUS 611 (EFIAPI *FRAMEWORK_EFI_HII_GET_GLYPH)( 612 IN EFI_HII_PROTOCOL *This, 613 IN CHAR16 *Source, 614 IN OUT UINT16 *Index, 615 OUT UINT8 **GlyphBuffer, 616 OUT UINT16 *BitWidth, 617 IN OUT UINT32 *InternalStatus 618 ); 619 620 /** 621 Translates a glyph into the format required for input to the Universal 622 Graphics Adapter (UGA) Block Transfer (BLT) routines. 623 624 @param This A pointer to the EFI_HII_PROTOCOL instance. 625 @param GlyphBuffer A pointer to the buffer that contains glyph data. 626 @param Foreground The foreground setting requested to be used for the 627 generated BltBuffer data. 628 @param Background The background setting requested to be used for the 629 generated BltBuffer data. 630 @param Count The entry in the BltBuffer upon which to act. 631 @param Width The width in bits of the glyph being converted. 632 @param Height The height in bits of the glyph being converted 633 @param BltBuffer A pointer to the buffer that contains the data that is 634 ready to be used by the UGA BLT routines. 635 636 @retval EFI_SUCCESS Successfully translated a glyph into the required 637 format for input to UGA BLT routines. 638 @retval EFI_NOT_FOUND A glyph for a character was not found. 639 @note Inconsistent with specification here: 640 In Framework Spec, HII specification 0.92. The type of 3rd, 4th and 8th parameter is EFI_UGA_PIXEL. 641 Here the definition uses the EFI_GRAPHICS_OUTPUT_BLT_PIXEL, which is defined in UEFI 2.1 specification. 642 **/ 643 typedef 644 EFI_STATUS 645 (EFIAPI *EFI_HII_GLYPH_TO_BLT)( 646 IN EFI_HII_PROTOCOL *This, 647 IN UINT8 *GlyphBuffer, 648 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground, 649 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background, 650 IN UINTN Count, 651 IN UINTN Width, 652 IN UINTN Height, 653 IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer 654 ); 655 656 /** 657 Allows a new string to be added to an already existing string package. 658 659 Note that this function prototype name is different from that in the Framework HII 0.92 specification 660 to avoid name confict with EFI_HII_NEW_STRING defined in the UEFI 2.1d specification. 661 662 @param This A pointer to the EFI_HII_PROTOCOL instance. 663 @param Pointer to a NULL-terminated string containing a single 664 ISO 639-2 language identifier, indicating the language 665 in which the string is translated. 666 @param Handle The handle of the language pack to which the string 667 is to be added. 668 @param Reference The identifier of the string to be added. If the 669 reference value is zero, then the string will be 670 assigned a new identifier on that handle for 671 the language specified. Otherwise, the string will 672 be updated with the NewString Value. 673 @param NewString The string to be added. 674 675 @retval EFI_SUCCESS The string was effectively registered. 676 @retval EFI_INVALID_PARAMETER The Handle was unknown. 677 678 **/ 679 typedef 680 EFI_STATUS 681 (EFIAPI *FRAMEWORK_EFI_HII_NEW_STRING)( 682 IN EFI_HII_PROTOCOL *This, 683 IN CHAR16 *Language, 684 IN FRAMEWORK_EFI_HII_HANDLE Handle, 685 IN OUT STRING_REF *Reference, 686 IN CHAR16 *NewString 687 ); 688 689 /** 690 Allows a program to determine the primary languages that are supported 691 on a given handle. 692 693 @param This A pointer to the EFI_HII_PROTOCOL instance. 694 @param Handle The handle on which the strings reside. 695 @param LanguageString A string allocated by GetPrimaryLanguages() that 696 contains a list of all primary languages registered 697 on the handle. 698 699 @retval EFI_SUCCESS LanguageString was correctly returned. 700 @retval EFI_INVALID_PARAMETER The Handle was unknown. 701 702 **/ 703 typedef 704 EFI_STATUS 705 (EFIAPI *EFI_HII_GET_PRI_LANGUAGES)( 706 IN EFI_HII_PROTOCOL *This, 707 IN FRAMEWORK_EFI_HII_HANDLE Handle, 708 OUT EFI_STRING *LanguageString 709 ); 710 711 /** 712 Allows a program to determine which secondary languages are supported 713 on a given handle for a given primary language. 714 715 @param This A pointer to the EFI_HII_PROTOCOL instance. 716 @param Handle The handle on which the strings reside. 717 @param PrimaryLanguage Pointer to a NULL-terminated string containing a 718 single ISO 639-2 language identifier, indicating 719 the primary language. 720 @param LanguageString A string allocated by GetSecondaryLanguages() 721 containing a list of all secondary languages 722 registered on the handle. 723 724 @retval EFI_SUCCESS LanguageString was correctly returned. 725 @retval EFI_INVALID_PARAMETER The Handle was unknown. 726 727 **/ 728 typedef 729 EFI_STATUS 730 (EFIAPI *EFI_HII_GET_SEC_LANGUAGES)( 731 IN EFI_HII_PROTOCOL *This, 732 IN FRAMEWORK_EFI_HII_HANDLE Handle, 733 IN CHAR16 *PrimaryLanguage, 734 OUT EFI_STRING *LanguageString 735 ); 736 737 /** 738 Extracts a string from a package already registered with the EFI HII database. 739 740 Note that this function prototype name is different from that in the Framework HII 0.92 specification 741 to avoid name confict with EFI_HII_GET_STRING defined in the UEFI 2.1d specification. 742 743 @param This A pointer to the EFI_HII_PROTOCOL instance. 744 @param Handle The handle on which the string resides. 745 @param Token The string token assigned to the string. 746 @param Raw If TRUE, the string is returned unedited in the 747 internal storage format. If false, the string 748 returned is edited by replacing <cr> with <space> 749 and by removing special characters such as the 750 <wide> prefix. 751 @param LanguageString Pointer to a NULL-terminated string containing a 752 single ISO 639-2 language identifier, indicating 753 the language to print. If the LanguageString is 754 empty (starts with a NULL), the default system 755 language will be used to determine the language. 756 @param BufferLength Length of the StringBuffer. 757 @param StringBuffer The buffer designed to receive the characters in the string. 758 759 @retval EFI_SUCCESS StringBuffer is filled with a NULL-terminated string. 760 @retval EFI_INVALID_PARAMETER The handle or string token is unknown. 761 @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to 762 allow the entire string to be stored. 763 764 **/ 765 typedef 766 EFI_STATUS 767 (EFIAPI *FRAMEWORK_EFI_HII_GET_STRING)( 768 IN EFI_HII_PROTOCOL *This, 769 IN FRAMEWORK_EFI_HII_HANDLE Handle, 770 IN STRING_REF Token, 771 IN BOOLEAN Raw, 772 IN CHAR16 *LanguageString, 773 IN OUT UINTN *BufferLength, 774 OUT EFI_STRING StringBuffer 775 ); 776 777 /** 778 Allows a program to extract a part of a string of not more than a given width. 779 780 @param This A pointer to the EFI_HII_PROTOCOL instance. 781 @param Handle The handle on which the string resides. 782 @param Token The string token assigned to the string. 783 @param Index On input, the offset into the string where the 784 line is to start. On output, the index is updated 785 to point beyond the last character returned in 786 the call. 787 @param LineWidth The maximum width of the line in units of narrow glyphs. 788 @param LanguageString The pointer to a NULL-terminated string containing a 789 single ISO 639-2 language identifier, indicating 790 the language to print. 791 @param BufferLength The pointer to the length of the StringBuffer. 792 @param StringBuffer The buffer designed to receive the characters in 793 the string. 794 795 @retval EFI_SUCCESS StringBuffer filled with characters that will fit 796 on the line. 797 @retval EFI_NOT_FOUND The font glyph for at least one of the characters in 798 the string is not in the font database. 799 @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough 800 to allow the entire string to be stored. 801 802 **/ 803 typedef 804 EFI_STATUS 805 (EFIAPI *EFI_HII_GET_LINE)( 806 IN EFI_HII_PROTOCOL *This, 807 IN FRAMEWORK_EFI_HII_HANDLE Handle, 808 IN STRING_REF Token, 809 IN OUT UINT16 *Index, 810 IN UINT16 LineWidth, 811 IN CHAR16 *LanguageString, 812 IN OUT UINT16 *BufferLength, 813 OUT EFI_STRING StringBuffer 814 ); 815 816 /** 817 Allows a program to extract a form or form package that has previously 818 been registered with the HII database. 819 820 @param This A pointer to the EFI_HII_PROTOCOL instance. 821 @param Handle Handle on which the form resides. 822 @param FormId The ID of the form to return. If the ID is zero, 823 the entire form package is returned. 824 @param BufferLength On input, the length of the Buffer. On output, 825 the length of the returned buffer, 826 @param Buffer The buffer designed to receive the form(s). 827 828 @retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength 829 was updated. 830 @retval EFI_INVALID_PARAMETER The handle is unknown. 831 @retval EFI_NOT_FOUND A form on the requested handle cannot be found with 832 the requested FormId. 833 @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough 834 to allow the form to be stored. 835 836 **/ 837 typedef 838 EFI_STATUS 839 (EFIAPI *EFI_HII_GET_FORMS)( 840 IN EFI_HII_PROTOCOL *This, 841 IN FRAMEWORK_EFI_HII_HANDLE Handle, 842 IN EFI_FORM_ID FormId, 843 IN OUT UINTN *BufferLength, 844 OUT UINT8 *Buffer 845 ); 846 847 /** 848 Extracts the defaults that are associated with a given handle in the HII database. 849 850 @param This A pointer to the EFI_HII_PROTOCOL instance. 851 @param Handle The HII handle from which will have default data retrieved. 852 @param DefaultMask The mask used to specify some type of default 853 override when extracting the default image data. 854 @param VariablePackList An indirect pointer to the first entry of a link 855 list with type EFI_HII_VARIABLE_PACK_LIST. 856 857 @retval EFI_SUCCESS The VariablePackList was populated with the appropriate 858 default setting data. 859 @retval EFI_NOT_FOUND The IFR does not have any explicit or default map(s). 860 @retval EFI_INVALID_PARAMETER The HII database entry associated with Handle 861 contains invalid data. 862 863 **/ 864 typedef 865 EFI_STATUS 866 (EFIAPI *EFI_HII_GET_DEFAULT_IMAGE)( 867 IN EFI_HII_PROTOCOL *This, 868 IN FRAMEWORK_EFI_HII_HANDLE Handle, 869 IN UINTN DefaultMask, 870 OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList 871 ); 872 873 /** 874 Allows the caller to update a form or form package that has previously been 875 registered with the EFI HII database. 876 877 @param This A pointer to the EFI_HII_PROTOCOL instance. 878 @param Handle Handle of the package where the form to be updated resides. 879 @param Label The label inside the form package where the update is to take place. 880 @param AddData If TRUE, adding data at a given Label; otherwise, 881 if FALSE, removing data at a given Label. 882 @param Data The buffer containing the new tags to insert after the Label 883 884 @retval EFI_SUCCESS The form was updated with the new tags. 885 @retval EFI_INVALID_PARAMETER The buffer for the buffer length does not 886 contain an integral number of tags. 887 @retval EFI_NOT_FOUND The Handle, Label, or FormId was not found. 888 889 **/ 890 typedef 891 EFI_STATUS 892 (EFIAPI *EFI_HII_UPDATE_FORM)( 893 IN EFI_HII_PROTOCOL *This, 894 IN FRAMEWORK_EFI_HII_HANDLE Handle, 895 IN EFI_FORM_LABEL Label, 896 IN BOOLEAN AddData, 897 IN EFI_HII_UPDATE_DATA *Data 898 ); 899 900 /** 901 Retrieves the current keyboard layout. 902 903 Note that this function prototype name is different from that in the Framework HII 0.92 specification 904 to avoid name confict with EFI_HII_GET_KEYBOARD_LAYOUT defined in the UEFI 2.1d specification. 905 906 @param This A pointer to the EFI_HII_PROTOCOL instance. 907 @param DescriptorCount A pointer to the number of Descriptor entries being 908 described in the keyboard layout being retrieved. 909 @param Descriptor A pointer to a buffer containing an array of 910 FRAMEWORK_EFI_KEY_DESCRIPTOR entries. Each entry 911 will reflect the definition of a specific physical key. 912 913 @retval EFI_SUCCESS The keyboard layout was retrieved successfully. 914 915 **/ 916 typedef 917 EFI_STATUS 918 (EFIAPI *FRAMEWORK_EFI_HII_GET_KEYBOARD_LAYOUT)( 919 IN EFI_HII_PROTOCOL *This, 920 OUT UINT16 *DescriptorCount, 921 OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor 922 ); 923 924 /// 925 /// The HII Protocol manages the HII database, which is a repository for data 926 /// having to do with fonts, strings, forms, keyboards, and other future human 927 /// interface items. 928 /// 929 struct _EFI_HII_PROTOCOL { 930 /// 931 /// Extracts the various packs from a package list. 932 /// 933 EFI_HII_NEW_PACK NewPack; 934 935 /// 936 /// Removes a package from the HII database. 937 /// 938 EFI_HII_REMOVE_PACK RemovePack; 939 940 /// 941 /// Determines the handles that are currently active in the database. 942 /// 943 EFI_HII_FIND_HANDLES FindHandles; 944 945 /// 946 /// Exports the entire contents of the database to a buffer. 947 /// 948 EFI_HII_EXPORT ExportDatabase; 949 950 /// 951 /// Tests if all of the characters in a string have corresponding font characters. 952 /// 953 EFI_HII_TEST_STRING TestString; 954 955 /// 956 /// Translates a Unicode character into the corresponding font glyph. 957 /// 958 FRAMEWORK_EFI_HII_GET_GLYPH GetGlyph; 959 960 /// 961 /// Converts a glyph value into a format that is ready for a UGA BLT command. 962 /// 963 EFI_HII_GLYPH_TO_BLT GlyphToBlt; 964 965 /// 966 /// Allows a new string to be added to an already existing string package. 967 /// 968 FRAMEWORK_EFI_HII_NEW_STRING NewString; 969 970 /// 971 /// Allows a program to determine the primary languages that are supported 972 /// on a given handle. 973 /// 974 EFI_HII_GET_PRI_LANGUAGES GetPrimaryLanguages; 975 976 /// 977 /// Allows a program to determine which secondary languages are supported 978 /// on a given handle for a given primary language. 979 /// 980 EFI_HII_GET_SEC_LANGUAGES GetSecondaryLanguages; 981 982 /// 983 /// Extracts a string from a package that is already registered with the 984 /// EFI HII database. 985 /// 986 FRAMEWORK_EFI_HII_GET_STRING GetString; 987 988 /// 989 /// Removes any new strings that were added after the initial string export 990 /// for this handle. 991 /// 992 /// Note this function is not defined in the Framework HII 0.92 specification. 993 /// 994 EFI_HII_RESET_STRINGS ResetStrings; 995 996 /// 997 /// Allows a program to extract a part of a string of not more than a given width. 998 /// 999 EFI_HII_GET_LINE GetLine; 1000 1001 /// 1002 /// Allows a program to extract a form or form package that has been previously registered. 1003 /// 1004 EFI_HII_GET_FORMS GetForms; 1005 1006 /// 1007 /// Allows a program to extract the nonvolatile image that represents the default storage image. 1008 /// 1009 EFI_HII_GET_DEFAULT_IMAGE GetDefaultImage; 1010 1011 /// 1012 /// Allows a program to update a previously registered form. 1013 /// 1014 EFI_HII_UPDATE_FORM UpdateForm; 1015 1016 /// 1017 /// Allows a program to extract the current keyboard layout. 1018 /// 1019 FRAMEWORK_EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout; 1020 }; 1021 1022 extern EFI_GUID gEfiHiiProtocolGuid; 1023 extern EFI_GUID gEfiHiiCompatibilityProtocolGuid; 1024 1025 #endif 1026 1027