Home | History | Annotate | Download | only in Framework
      1 /** @file
      2   This file defines the encoding for the VFR (Visual Form Representation) language.
      3   Framework IFR is primarily consumed by the EFI presentation engine, and produced by EFI
      4   internal application and drivers as well as all add-in card option-ROM drivers
      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   These definitions are from the Framework Specification HII 0.92.
     17 
     18 **/
     19 
     20 #ifndef __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__
     21 #define __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__
     22 
     23 typedef UINT16  STRING_REF;
     24 
     25 //
     26 // IFR Op codes
     27 //
     28 #define FRAMEWORK_EFI_IFR_FORM_OP                 0x01
     29 #define FRAMEWORK_EFI_IFR_SUBTITLE_OP             0x02
     30 #define FRAMEWORK_EFI_IFR_TEXT_OP                 0x03
     31 #define EFI_IFR_GRAPHIC_OP                        0x04
     32 #define FRAMEWORK_EFI_IFR_ONE_OF_OP               0x05
     33 #define FRAMEWORK_EFI_IFR_CHECKBOX_OP             0x06
     34 #define FRAMEWORK_EFI_IFR_NUMERIC_OP              0x07
     35 #define FRAMEWORK_EFI_IFR_PASSWORD_OP             0x08
     36 #define FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP        0x09  ///< ONEOF OPTION field.
     37 #define FRAMEWORK_EFI_IFR_SUPPRESS_IF_OP          0x0A
     38 #define EFI_IFR_END_FORM_OP                       0x0B
     39 #define EFI_IFR_HIDDEN_OP                         0x0C
     40 #define EFI_IFR_END_FORM_SET_OP                   0x0D
     41 #define FRAMEWORK_EFI_IFR_FORM_SET_OP             0x0E
     42 #define FRAMEWORK_EFI_IFR_REF_OP                  0x0F
     43 #define EFI_IFR_END_ONE_OF_OP                     0x10
     44 #define FRAMEWORK_EFI_IFR_END_OP                  EFI_IFR_END_ONE_OF_OP
     45 #define FRAMEWORK_EFI_IFR_INCONSISTENT_IF_OP      0x11
     46 #define FRAMEWORK_EFI_IFR_EQ_ID_VAL_OP            0x12
     47 #define FRAMEWORK_EFI_IFR_EQ_ID_ID_OP             0x13
     48 #define FRAMEWORK_EFI_IFR_EQ_ID_LIST_OP           0x14
     49 #define FRAMEWORK_EFI_IFR_AND_OP                  0x15
     50 #define FRAMEWORK_EFI_IFR_OR_OP                   0x16
     51 #define FRAMEWORK_EFI_IFR_NOT_OP                  0x17
     52 #define EFI_IFR_END_IF_OP                         0x18  ///< For endif of inconsistentif, suppressif, grayoutif.
     53 #define EFI_IFR_GRAYOUT_IF_OP                     0x19
     54 #define FRAMEWORK_EFI_IFR_DATE_OP                 0x1A
     55 #define FRAMEWORK_EFI_IFR_TIME_OP                 0x1B
     56 #define FRAMEWORK_EFI_IFR_STRING_OP               0x1C
     57 #define EFI_IFR_LABEL_OP                          0x1D
     58 #define EFI_IFR_SAVE_DEFAULTS_OP                  0x1E
     59 #define EFI_IFR_RESTORE_DEFAULTS_OP               0x1F
     60 #define EFI_IFR_BANNER_OP                         0x20
     61 #define EFI_IFR_INVENTORY_OP                      0x21
     62 #define EFI_IFR_EQ_VAR_VAL_OP                     0x22
     63 #define FRAMEWORK_EFI_IFR_ORDERED_LIST_OP         0x23
     64 #define FRAMEWORK_EFI_IFR_VARSTORE_OP             0x24
     65 #define EFI_IFR_VARSTORE_SELECT_OP                0x25
     66 #define EFI_IFR_VARSTORE_SELECT_PAIR_OP           0x26
     67 #define EFI_IFR_LAST_OPCODE                       EFI_IFR_VARSTORE_SELECT_PAIR_OP
     68 #define EFI_IFR_OEM_OP                            0xFE
     69 #define EFI_IFR_NV_ACCESS_COMMAND                 0xFF
     70 
     71 //
     72 // Define values for the flags fields in some VFR opcodes. These are
     73 // bitmasks.
     74 //
     75 #define EFI_IFR_FLAG_DEFAULT            0x01
     76 #define EFI_IFR_FLAG_MANUFACTURING      0x02
     77 #define EFI_IFR_FLAG_INTERACTIVE        0x04
     78 #define EFI_IFR_FLAG_NV_ACCESS          0x08
     79 #define EFI_IFR_FLAG_RESET_REQUIRED     0x10
     80 #define EFI_IFR_FLAG_LATE_CHECK         0x20
     81 
     82 #define EFI_NON_DEVICE_CLASS              0x00  ///< Useful when you do not want something in the Device Manager.
     83 #define EFI_DISK_DEVICE_CLASS             0x01
     84 #define EFI_VIDEO_DEVICE_CLASS            0x02
     85 #define EFI_NETWORK_DEVICE_CLASS          0x04
     86 #define EFI_INPUT_DEVICE_CLASS            0x08
     87 #define EFI_ON_BOARD_DEVICE_CLASS         0x10
     88 #define EFI_OTHER_DEVICE_CLASS            0x20
     89 
     90 #define EFI_SETUP_APPLICATION_SUBCLASS    0x00
     91 #define EFI_GENERAL_APPLICATION_SUBCLASS  0x01
     92 #define EFI_FRONT_PAGE_SUBCLASS           0x02
     93 #define EFI_SINGLE_USE_SUBCLASS           0x03  ///< Used to display a single entity ,and then exit.
     94 
     95 ///
     96 /// Used to flag dynamically created op-codes. This is meaningful to the IFR Library set
     97 /// and the browser because we need to distinguish between compiled NV map data and created data.
     98 /// We do not allow new entries to be created in the NV map dynamically, but we do need
     99 /// to display this information correctly.  To dynamically create op-codes and assume that their
    100 /// data will be saved, ensure that the NV starting location they refer to is pre-defined in the
    101 /// NV map.
    102 ///
    103 #define EFI_IFR_FLAG_CREATED  128
    104 
    105 
    106 #pragma pack(1)
    107 //
    108 // IFR Structure definitions
    109 //
    110 typedef struct {
    111   UINT8                             OpCode;
    112   UINT8                             Length;
    113 } FRAMEWORK_EFI_IFR_OP_HEADER;
    114 
    115 typedef struct {
    116   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    117   EFI_GUID                          Guid;
    118   STRING_REF                        FormSetTitle;
    119   STRING_REF                        Help;
    120   EFI_PHYSICAL_ADDRESS              CallbackHandle;
    121   UINT16                            Class;
    122   UINT16                            SubClass;
    123   UINT16                            NvDataSize; ///< Set once; the size of the NV data as defined in the script.
    124 } FRAMEWORK_EFI_IFR_FORM_SET;
    125 
    126 typedef struct {
    127   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    128   UINT16                            FormId;
    129   STRING_REF                        FormTitle;
    130 } FRAMEWORK_EFI_IFR_FORM;
    131 
    132 typedef struct {
    133   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    134   UINT16                            LabelId;
    135 } EFI_IFR_LABEL;
    136 
    137 typedef struct {
    138   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    139   STRING_REF                        SubTitle;
    140 } FRAMEWORK_EFI_IFR_SUBTITLE;
    141 
    142 typedef struct {
    143   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    144   STRING_REF                        Help;
    145   STRING_REF                        Text;
    146   STRING_REF                        TextTwo;
    147   UINT8                             Flags;  ///< This is included solely for purposes of interactive/dynamic support.
    148   UINT16                            Key;    ///< The value to be passed to the caller to identify this particular op-code.
    149 } FRAMEWORK_EFI_IFR_TEXT;
    150 
    151 //
    152 // goto
    153 //
    154 typedef struct {
    155   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    156   UINT16                            FormId;
    157   STRING_REF                        Prompt;
    158   STRING_REF                        Help;   ///< The string Token for the context-help.
    159   UINT8                             Flags;  ///< This is included solely for purposes of interactive/dynamic support.
    160   UINT16                            Key;    ///< The value to be passed to the caller to identify this particular op-code.
    161 } FRAMEWORK_EFI_IFR_REF;
    162 
    163 typedef struct {
    164   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    165 } EFI_IFR_END_FORM;
    166 
    167 typedef struct {
    168   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    169 } EFI_IFR_END_FORM_SET;
    170 
    171 //
    172 // Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure......
    173 // code assumes this to be true, if this ever changes we need to revisit the InitializeTagStructures code
    174 //
    175 typedef struct {
    176   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    177   UINT16                            QuestionId; ///< The ID designating what the question is about...
    178   UINT8                             Width;      ///< The Size of the Data being saved.
    179   STRING_REF                        Prompt;     ///< The String Token for the Prompt.
    180   STRING_REF                        Help;       ///< The string Token for the context-help.
    181 } FRAMEWORK_EFI_IFR_ONE_OF;
    182 
    183 typedef struct {
    184   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    185   UINT16                            QuestionId; ///< The offset in NV for storage of the data.
    186   UINT8                             MaxEntries; ///< The maximum number of options in the ordered list (=size of NVStore).
    187   STRING_REF                        Prompt;     ///< The string token for the prompt.
    188   STRING_REF                        Help;       ///< The string token for the context-help.
    189 } FRAMEWORK_EFI_IFR_ORDERED_LIST;
    190 
    191 typedef struct {
    192   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    193   UINT16                            QuestionId; ///< The ID designating what the question is about...
    194   UINT8                             Width;      ///< The Size of the Data being saved.
    195   STRING_REF                        Prompt;     ///< The String Token for the Prompt.
    196   STRING_REF                        Help;       ///< The string Token for the context-help.
    197   UINT8                             Flags;      ///< If non-zero, it means that it is the default option.
    198   UINT16                            Key;        ///< Value to be passed to caller to identify this particular op-code.
    199 } FRAMEWORK_EFI_IFR_CHECKBOX, EFI_IFR_CHECK_BOX;
    200 
    201 typedef struct {
    202   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    203   STRING_REF                        Option;     ///< The string token describing the option.
    204   UINT16                            Value;      ///< The value associated with this option that is stored in the NVRAM.
    205   UINT8                             Flags;      ///< If non-zero, it means that it is the default option.
    206   UINT16                            Key;        ///< Value to be passed to caller to identify this particular op-code.
    207 } FRAMEWORK_EFI_IFR_ONE_OF_OPTION;
    208 
    209 typedef struct {
    210   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    211   UINT16                            QuestionId; ///< The ID designating what the question is about...
    212   UINT8                             Width;      ///< The Size of the Data being saved.
    213   STRING_REF                        Prompt;     ///< The String Token for the Prompt.
    214   STRING_REF                        Help;       ///< The string Token for the context-help.
    215   UINT8                             Flags;      ///< This is included solely for purposes of interactive/dynamic support.
    216   UINT16                            Key;        ///< The value to be passed to caller to identify this particular op-code.
    217   UINT16                            Minimum;
    218   UINT16                            Maximum;
    219   UINT16                            Step;       ///< Zero means manual input. Otherwise, arrow selection is called for.
    220   UINT16                            Default;
    221 } FRAMEWORK_EFI_IFR_NUMERIC;
    222 
    223 //
    224 // There is an interesting twist with regards to Time and Date.  This is one of the few items which can accept input
    225 // from a user, and may or may not need to use storage in the NVRAM space.  The decided method for determining
    226 // if NVRAM space will be used (only for a TimeOp or DateOp) is:  If .QuestionId == 0 && .Width == 0 (normally an
    227 // impossibility) then use system resources to store the data away and not NV resources.  In other words, the setup
    228 // engine will call gRT->SetTime, and gRT->SetDate for the saving of data, and the values displayed will be from the
    229 // gRT->GetXXXX series of calls.
    230 //
    231 typedef struct {
    232   FRAMEWORK_EFI_IFR_NUMERIC         Hour;
    233   FRAMEWORK_EFI_IFR_NUMERIC         Minute;
    234   FRAMEWORK_EFI_IFR_NUMERIC         Second;
    235 } FRAMEWORK_EFI_IFR_TIME;
    236 
    237 typedef struct {
    238   FRAMEWORK_EFI_IFR_NUMERIC         Year;
    239   FRAMEWORK_EFI_IFR_NUMERIC         Month;
    240   FRAMEWORK_EFI_IFR_NUMERIC         Day;
    241 } FRAMEWORK_EFI_IFR_DATE;
    242 
    243 typedef struct {
    244   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    245   UINT16                            QuestionId;///< The ID designating what the question is about...
    246   UINT8                             Width;     ///< The Size of the Data being saved.
    247   STRING_REF                        Prompt;    ///< The String Token for the Prompt.
    248   STRING_REF                        Help;      ///< The string Token for the context-help.
    249   UINT8                             Flags;     ///< This is included solely for purposes of interactive/dynamic support.
    250   UINT16                            Key;       ///< The value to be passed to caller to identify this particular op-code.
    251   UINT8                             MinSize;   ///< Minimum allowable sized password.
    252   UINT8                             MaxSize;   ///< Maximum allowable sized password.
    253   UINT16                            Encoding;
    254 } FRAMEWORK_EFI_IFR_PASSWORD;
    255 
    256 typedef struct {
    257   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    258   UINT16                            QuestionId; ///< The ID designating what the question is about...
    259   UINT8                             Width;      ///< The Size of the Data being saved.
    260   STRING_REF                        Prompt;     ///< The String Token for the Prompt.
    261   STRING_REF                        Help;       ///< The string Token for the context-help.
    262   UINT8                             Flags;      ///< This is included solely for purposes of interactive/dynamic support.
    263   UINT16                            Key;        ///< The value to be passed to caller to identify this particular op-code.
    264   UINT8                             MinSize;    ///< Minimum allowable sized password.
    265   UINT8                             MaxSize;    ///< Maximum allowable sized password.
    266 } FRAMEWORK_EFI_IFR_STRING;
    267 
    268 typedef struct {
    269   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    270 } EFI_IFR_END_ONE_OF;
    271 
    272 typedef struct {
    273   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    274   UINT16                            Value;
    275   UINT16                            Key;
    276 } EFI_IFR_HIDDEN;
    277 
    278 ///
    279 /// Inconsistent with specification here:
    280 /// The following defintion may not comply with Framework Specification HII 0.92. To
    281 /// keep the inconsistant is for implementation needed.
    282 ///@{
    283 typedef struct {
    284   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    285   UINT8                             Flags;
    286 } EFI_IFR_SUPPRESS;
    287 
    288 typedef struct {
    289   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    290   UINT8                             Flags;
    291 } EFI_IFR_GRAY_OUT;
    292 
    293 typedef struct {
    294   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    295   STRING_REF                        Popup;
    296   UINT8                             Flags;
    297 } EFI_IFR_INCONSISTENT;
    298 
    299 typedef struct {
    300   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    301   UINT16                            QuestionId;   ///< The offset into variable storage.
    302   UINT8                             Width;        ///< The size of variable storage.
    303   UINT16                            Value;        ///< The value to compare against.
    304 } FRAMEWORK_EFI_IFR_EQ_ID_VAL;
    305 
    306 typedef struct {
    307   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    308   UINT16                            QuestionId;   ///< The offset into variable storage.
    309   UINT8                             Width;        ///< The size of variable storage.
    310   UINT16                            ListLength;
    311   UINT16                            ValueList[1];
    312 } FRAMEWORK_EFI_IFR_EQ_ID_LIST;
    313 
    314 typedef struct {
    315   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    316   UINT16                            QuestionId1;  ///< The offset into variable storage for first value to compare.
    317   UINT8                             Width;        ///< The size of variable storage (must be same for both).
    318   UINT16                            QuestionId2;  ///< The offset into variable storage for second value to compare.
    319 } FRAMEWORK_EFI_IFR_EQ_ID_ID;
    320 
    321 typedef struct {
    322   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    323   UINT16                            VariableId;   ///< The offset into variable storage.
    324   UINT16                            Value;        ///< The value to compare against.
    325 } EFI_IFR_EQ_VAR_VAL;
    326 ///@}
    327 
    328 typedef struct {
    329   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    330 } FRAMEWORK_EFI_IFR_AND;
    331 
    332 typedef struct {
    333   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    334 } FRAMEWORK_EFI_IFR_OR;
    335 
    336 typedef struct {
    337   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    338 } FRAMEWORK_EFI_IFR_NOT;
    339 
    340 typedef struct {
    341   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    342 } EFI_IFR_END_EXPR, EFI_IFR_END_IF;
    343 
    344 typedef struct {
    345   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    346   UINT16                            FormId;
    347   STRING_REF                        Prompt;
    348   STRING_REF                        Help;
    349   UINT8                             Flags;
    350   UINT16                            Key;
    351 } EFI_IFR_SAVE_DEFAULTS;
    352 
    353 typedef struct {
    354   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    355   STRING_REF                        Help;
    356   STRING_REF                        Text;
    357   STRING_REF                        TextTwo;    ///< Optional text.
    358 } EFI_IFR_INVENTORY;
    359 
    360 typedef struct {
    361   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    362   EFI_GUID                          Guid;       ///< GUID for the variable.
    363   UINT16                            VarId;      ///< The variable store ID, as referenced elsewhere in the form.
    364   UINT16                            Size;       ///< The size of the variable storage.
    365 } FRAMEWORK_EFI_IFR_VARSTORE;
    366 
    367 typedef struct {
    368   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    369   UINT16                            VarId;      ///< The variable store ID, as referenced elsewhere in the form.
    370 } EFI_IFR_VARSTORE_SELECT;
    371 
    372 ///
    373 /// Used for the ideqid VFR statement where two variable stores may be referenced in the
    374 /// same VFR statement.
    375 /// A browser should treat this as an FRAMEWORK_EFI_IFR_VARSTORE_SELECT statement and assume that all following
    376 /// IFR opcodes use the VarId as defined here.
    377 ///
    378 typedef struct {
    379   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    380   UINT16                            VarId;          ///< The variable store ID, as referenced elsewhere in the form.
    381   UINT16                            SecondaryVarId; ///< The variable store ID, as referenced elsewhere in the form.
    382 } EFI_IFR_VARSTORE_SELECT_PAIR;
    383 
    384 ///
    385 /// Save defaults and restore defaults have same structure.
    386 ///
    387 #define EFI_IFR_RESTORE_DEFAULTS  EFI_IFR_SAVE_DEFAULTS
    388 
    389 typedef struct {
    390   FRAMEWORK_EFI_IFR_OP_HEADER       Header;
    391   STRING_REF                        Title;        ///< The string token for the banner title.
    392   UINT16                            LineNumber;   ///< 1-based line number.
    393   UINT8                             Alignment;    ///< Left, center, or right-aligned.
    394 } EFI_IFR_BANNER;
    395 
    396 #define EFI_IFR_BANNER_ALIGN_LEFT   0
    397 #define EFI_IFR_BANNER_ALIGN_CENTER 1
    398 #define EFI_IFR_BANNER_ALIGN_RIGHT  2
    399 #define EFI_IFR_BANNER_TIMEOUT      0xFF
    400 
    401 #pragma pack()
    402 
    403 #endif
    404