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