Home | History | Annotate | Download | only in Include
      1 /*++
      2 
      3 Copyright (c) 2004 - 2005, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 Module Name:
     13 
     14   EfiInternalFormRepresentation.h
     15 
     16 Abstract:
     17 
     18   This file defines the encoding for the VFR (Visual Form Representation) language.
     19   IFR is primarily consumed by the EFI presentation engine, and produced by EFI
     20   internal application and drivers as well as all add-in card option-ROM drivers
     21 
     22 --*/
     23 
     24 #ifndef _EFI_INTERNAL_FORM_REPRESENTATION_H_
     25 #define _EFI_INTERNAL_FORM_REPRESENTATION_H_
     26 
     27 //
     28 // The following types are currently defined:
     29 //
     30 typedef UINT32  RELOFST;
     31 typedef UINT16  STRING_REF;
     32 typedef CHAR16  *EFI_STRING;
     33 
     34 //
     35 // IFR Op codes
     36 //
     37 #define EFI_IFR_FORM_OP                 0x01
     38 #define EFI_IFR_SUBTITLE_OP             0x02
     39 #define EFI_IFR_TEXT_OP                 0x03
     40 #define EFI_IFR_GRAPHIC_OP              0x04
     41 #define EFI_IFR_ONE_OF_OP               0x05
     42 #define EFI_IFR_CHECKBOX_OP             0x06
     43 #define EFI_IFR_NUMERIC_OP              0x07
     44 #define EFI_IFR_PASSWORD_OP             0x08
     45 #define EFI_IFR_ONE_OF_OPTION_OP        0x09  // ONEOF OPTION field
     46 #define EFI_IFR_SUPPRESS_IF_OP          0x0A
     47 #define EFI_IFR_END_FORM_OP             0x0B
     48 #define EFI_IFR_HIDDEN_OP               0x0C
     49 #define EFI_IFR_END_FORM_SET_OP         0x0D
     50 #define EFI_IFR_FORM_SET_OP             0x0E
     51 #define EFI_IFR_REF_OP                  0x0F
     52 #define EFI_IFR_END_ONE_OF_OP           0x10
     53 #define EFI_IFR_END_OP                  EFI_IFR_END_ONE_OF_OP
     54 #define EFI_IFR_INCONSISTENT_IF_OP      0x11
     55 #define EFI_IFR_EQ_ID_VAL_OP            0x12
     56 #define EFI_IFR_EQ_ID_ID_OP             0x13
     57 #define EFI_IFR_EQ_ID_LIST_OP           0x14
     58 #define EFI_IFR_AND_OP                  0x15
     59 #define EFI_IFR_OR_OP                   0x16
     60 #define EFI_IFR_NOT_OP                  0x17
     61 #define EFI_IFR_END_IF_OP               0x18  // for endif of inconsistentif, suppressif, grayoutif
     62 #define EFI_IFR_GRAYOUT_IF_OP           0x19
     63 #define EFI_IFR_DATE_OP                 0x1A
     64 #define EFI_IFR_TIME_OP                 0x1B
     65 #define EFI_IFR_STRING_OP               0x1C
     66 #define EFI_IFR_LABEL_OP                0x1D
     67 #define EFI_IFR_SAVE_DEFAULTS_OP        0x1E
     68 #define EFI_IFR_RESTORE_DEFAULTS_OP     0x1F
     69 #define EFI_IFR_BANNER_OP               0x20
     70 #define EFI_IFR_INVENTORY_OP            0x21
     71 #define EFI_IFR_EQ_VAR_VAL_OP           0x22
     72 #define EFI_IFR_ORDERED_LIST_OP         0x23
     73 #define EFI_IFR_VARSTORE_OP             0x24
     74 #define EFI_IFR_VARSTORE_SELECT_OP      0x25
     75 #define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26
     76 #define EFI_IFR_TRUE_OP                 0x27
     77 #define EFI_IFR_FALSE_OP                0x28
     78 #define EFI_IFR_GT_OP                   0x29
     79 #define EFI_IFR_GE_OP                   0x2A
     80 #define EFI_IFR_OEM_DEFINED_OP          0x2B
     81 #define EFI_IFR_LAST_OPCODE             EFI_IFR_OEM_DEFINED_OP
     82 #define EFI_IFR_OEM_OP                  0xFE
     83 #define EFI_IFR_NV_ACCESS_COMMAND       0xFF
     84 
     85 //
     86 // Define values for the flags fields in some VFR opcodes. These are
     87 // bitmasks.
     88 //
     89 #define EFI_IFR_FLAG_DEFAULT              0x01
     90 #define EFI_IFR_FLAG_MANUFACTURING        0x02
     91 #define EFI_IFR_FLAG_INTERACTIVE          0x04
     92 #define EFI_IFR_FLAG_NV_ACCESS            0x08
     93 #define EFI_IFR_FLAG_RESET_REQUIRED       0x10
     94 #define EFI_IFR_FLAG_LATE_CHECK           0x20
     95 
     96 #define EFI_NON_DEVICE_CLASS              0x00  // Useful when you do not want something in the Device Manager
     97 #define EFI_DISK_DEVICE_CLASS             0x01
     98 #define EFI_VIDEO_DEVICE_CLASS            0x02
     99 #define EFI_NETWORK_DEVICE_CLASS          0x04
    100 #define EFI_INPUT_DEVICE_CLASS            0x08
    101 #define EFI_ON_BOARD_DEVICE_CLASS         0x10
    102 #define EFI_OTHER_DEVICE_CLASS            0x20
    103 
    104 #define EFI_SETUP_APPLICATION_SUBCLASS    0x00
    105 #define EFI_GENERAL_APPLICATION_SUBCLASS  0x01
    106 #define EFI_FRONT_PAGE_SUBCLASS           0x02
    107 #define EFI_SINGLE_USE_SUBCLASS           0x03  // Used to display a single entity and then exit
    108 //
    109 // Used to flag dynamically created op-codes. This is meaningful to the IFR Library set
    110 // and the browser since we need to distinguish between compiled NV map data and created data.
    111 // We do not allow new entries to be created in the NV map dynamically however we still need
    112 // to display this information correctly.  To dynamically create op-codes and assume that their
    113 // data will be saved, ensure that the NV starting location they refer to is pre-defined in the
    114 // NV map.
    115 //
    116 #define EFI_IFR_FLAG_CREATED  128
    117 
    118 #pragma pack(1)
    119 //
    120 // IFR Structure definitions
    121 //
    122 typedef struct {
    123   UINT8 OpCode;
    124   UINT8 Length;
    125 } EFI_IFR_OP_HEADER;
    126 
    127 typedef struct {
    128   EFI_IFR_OP_HEADER     Header;
    129   EFI_GUID              Guid;
    130   STRING_REF            FormSetTitle;
    131   STRING_REF            Help;
    132   EFI_PHYSICAL_ADDRESS  CallbackHandle;
    133   UINT16                Class;
    134   UINT16                SubClass;
    135   UINT16                NvDataSize; // set once, size of the NV data as defined in the script
    136 } EFI_IFR_FORM_SET;
    137 
    138 typedef struct {
    139   EFI_IFR_OP_HEADER Header;
    140   UINT16            FormId;
    141   STRING_REF        FormTitle;
    142 } EFI_IFR_FORM;
    143 
    144 typedef struct {
    145   EFI_IFR_OP_HEADER Header;
    146   UINT16            LabelId;
    147 } EFI_IFR_LABEL;
    148 
    149 typedef struct {
    150   EFI_IFR_OP_HEADER Header;
    151   STRING_REF        SubTitle;
    152 } EFI_IFR_SUBTITLE;
    153 
    154 typedef struct {
    155   EFI_IFR_OP_HEADER Header;
    156   STRING_REF        Help;
    157   STRING_REF        Text;
    158   STRING_REF        TextTwo;
    159   UINT8             Flags;          // This is included solely for purposes of interactive/dynamic support.
    160   UINT16            Key;            // Value to be passed to caller to identify this particular op-code
    161 } EFI_IFR_TEXT;
    162 
    163 //
    164 // goto
    165 //
    166 typedef struct {
    167   EFI_IFR_OP_HEADER Header;
    168   UINT16            FormId;
    169   STRING_REF        Prompt;
    170   STRING_REF        Help;   // The string Token for the context-help
    171   UINT8             Flags;  // This is included solely for purposes of interactive/dynamic support.
    172   UINT16            Key;    // Value to be passed to caller to identify this particular op-code
    173 } EFI_IFR_REF;
    174 
    175 typedef struct {
    176   EFI_IFR_OP_HEADER Header;
    177 } EFI_IFR_END_FORM;
    178 
    179 typedef struct {
    180   EFI_IFR_OP_HEADER Header;
    181 } EFI_IFR_END_FORM_SET;
    182 
    183 //
    184 // Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure......code assumes this to be true, if this ever
    185 // changes we need to revisit the InitializeTagStructures code
    186 //
    187 typedef struct {
    188   EFI_IFR_OP_HEADER Header;
    189   UINT16            QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
    190   UINT8             Width;      // The Size of the Data being saved
    191   STRING_REF        Prompt;     // The String Token for the Prompt
    192   STRING_REF        Help;       // The string Token for the context-help
    193 } EFI_IFR_ONE_OF;
    194 
    195 typedef struct {
    196   EFI_IFR_OP_HEADER Header;
    197   UINT16            QuestionId; // The offset in NV for storage of the data
    198   UINT8             MaxEntries; // The maximum number of options in the ordered list (=size of NVStore)
    199   STRING_REF        Prompt;     // The string token for the prompt
    200   STRING_REF        Help;       // The string token for the context-help
    201 } EFI_IFR_ORDERED_LIST;
    202 
    203 typedef struct {
    204   EFI_IFR_OP_HEADER Header;
    205   UINT16            QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
    206   UINT8             Width;      // The Size of the Data being saved
    207   STRING_REF        Prompt;     // The String Token for the Prompt
    208   STRING_REF        Help;       // The string Token for the context-help
    209   UINT8             Flags;      // For now, if non-zero, means that it is the default option, - further definition likely
    210   UINT16            Key;        // Value to be passed to caller to identify this particular op-code
    211 } EFI_IFR_CHECK_BOX;
    212 
    213 typedef struct {
    214   EFI_IFR_OP_HEADER Header;
    215   STRING_REF        Option;     // The string token describing the option
    216   UINT16            Value;      // The value associated with this option that is stored in the NVRAM if chosen
    217   UINT8             Flags;      // For now, if non-zero, means that it is the default option, - further definition likely above
    218   UINT16            Key;        // Value to be passed to caller to identify this particular op-code
    219 } EFI_IFR_ONE_OF_OPTION;
    220 
    221 typedef struct {
    222   EFI_IFR_OP_HEADER Header;
    223   UINT16            QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
    224   UINT8             Width;      // The Size of the Data being saved
    225   STRING_REF        Prompt;     // The String Token for the Prompt
    226   STRING_REF        Help;       // The string Token for the context-help
    227   UINT8             Flags;      // This is included solely for purposes of interactive/dynamic support.
    228   UINT16            Key;        // Value to be passed to caller to identify this particular op-code
    229   UINT16            Minimum;
    230   UINT16            Maximum;
    231   UINT16            Step;       // If step is 0, then manual input is specified, otherwise, left/right arrow selection is called for
    232   UINT16            Default;
    233 } EFI_IFR_NUMERIC;
    234 
    235 //
    236 // There is an interesting twist with regards to Time and Date.  This is one of the few items which can accept input from
    237 // a user, however may or may not need to use storage in the NVRAM space.  The decided method for determining if NVRAM space
    238 // will be used (only for a TimeOp or DateOp) is:  If .QuestionId == 0 && .Width == 0 (normally an impossibility) then use system
    239 // resources to store the data away and not NV resources.  In other words, the setup engine will call gRT->SetTime, and gRT->SetDate
    240 // for the saving of data, and the values displayed will be from the gRT->GetXXXX series of calls.
    241 //
    242 typedef struct {
    243   EFI_IFR_NUMERIC Hour;
    244   EFI_IFR_NUMERIC Minute;
    245   EFI_IFR_NUMERIC Second;
    246 } EFI_IFR_TIME;
    247 
    248 typedef struct {
    249   EFI_IFR_NUMERIC Year;
    250   EFI_IFR_NUMERIC Month;
    251   EFI_IFR_NUMERIC Day;
    252 } EFI_IFR_DATE;
    253 
    254 typedef struct {
    255   EFI_IFR_OP_HEADER Header;
    256   UINT16            QuestionId;   // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
    257   UINT8             Width;        // The Size of the Data being saved -- BUGBUG -- remove someday
    258   STRING_REF        Prompt;       // The String Token for the Prompt
    259   STRING_REF        Help;         // The string Token for the context-help
    260   UINT8             Flags;        // This is included solely for purposes of interactive/dynamic support.
    261   UINT16            Key;          // Value to be passed to caller to identify this particular op-code
    262   UINT8             MinSize;      // Minimum allowable sized password
    263   UINT8             MaxSize;      // Maximum allowable sized password
    264   UINT16            Encoding;
    265 } EFI_IFR_PASSWORD;
    266 
    267 typedef struct {
    268   EFI_IFR_OP_HEADER Header;
    269   UINT16            QuestionId;   // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
    270   UINT8             Width;        // The Size of the Data being saved -- BUGBUG -- remove someday
    271   STRING_REF        Prompt;       // The String Token for the Prompt
    272   STRING_REF        Help;         // The string Token for the context-help
    273   UINT8             Flags;        // This is included solely for purposes of interactive/dynamic support.
    274   UINT16            Key;          // Value to be passed to caller to identify this particular op-code
    275   UINT8             MinSize;      // Minimum allowable sized password
    276   UINT8             MaxSize;      // Maximum allowable sized password
    277 } EFI_IFR_STRING;
    278 
    279 typedef struct {
    280   EFI_IFR_OP_HEADER Header;
    281 } EFI_IFR_END_ONE_OF;
    282 
    283 typedef struct {
    284   EFI_IFR_OP_HEADER Header;
    285   UINT16            Value;
    286   UINT16            Key;
    287 } EFI_IFR_HIDDEN;
    288 
    289 typedef struct {
    290   EFI_IFR_OP_HEADER Header;
    291   UINT8             Flags;
    292 } EFI_IFR_SUPPRESS;
    293 
    294 typedef struct {
    295   EFI_IFR_OP_HEADER Header;
    296   UINT8             Flags;
    297 } EFI_IFR_GRAYOUT;
    298 
    299 typedef struct {
    300   EFI_IFR_OP_HEADER Header;
    301   STRING_REF        Popup;
    302   UINT8             Flags;
    303 } EFI_IFR_INCONSISTENT;
    304 
    305 typedef struct {
    306   EFI_IFR_OP_HEADER Header;
    307   UINT16            QuestionId;   // offset into variable storage
    308   UINT8             Width;        // size of variable storage
    309   UINT16            Value;        // value to compare against
    310 } EFI_IFR_EQ_ID_VAL;
    311 
    312 typedef struct {
    313   EFI_IFR_OP_HEADER Header;
    314   UINT16            QuestionId;   // offset into variable storage
    315   UINT8             Width;        // size of variable storage
    316   UINT16            ListLength;
    317   UINT16            ValueList[1];
    318 } EFI_IFR_EQ_ID_LIST;
    319 
    320 typedef struct {
    321   EFI_IFR_OP_HEADER Header;
    322   UINT16            QuestionId1;  // offset into variable storage for first value to compare
    323   UINT8             Width;        // size of variable storage (must be same for both)
    324   UINT16            QuestionId2;  // offset into variable storage for second value to compare
    325 } EFI_IFR_EQ_ID_ID;
    326 
    327 typedef struct {
    328   EFI_IFR_OP_HEADER Header;
    329   UINT16            VariableId;   // offset into variable storage
    330   UINT16            Value;        // value to compare against
    331 } EFI_IFR_EQ_VAR_VAL;
    332 
    333 typedef struct {
    334   EFI_IFR_OP_HEADER Header;
    335 } EFI_IFR_AND;
    336 
    337 typedef struct {
    338   EFI_IFR_OP_HEADER Header;
    339 } EFI_IFR_OR;
    340 
    341 typedef struct {
    342   EFI_IFR_OP_HEADER Header;
    343 } EFI_IFR_NOT;
    344 
    345 typedef struct {
    346   EFI_IFR_OP_HEADER Header;
    347 } EFI_IFR_END_IF;
    348 
    349 typedef struct {
    350   EFI_IFR_OP_HEADER Header;
    351   UINT16            FormId;
    352   STRING_REF        Prompt;
    353   STRING_REF        Help;
    354   UINT8             Flags;
    355   UINT16            Key;
    356 } EFI_IFR_SAVE_DEFAULTS;
    357 
    358 typedef struct {
    359   EFI_IFR_OP_HEADER Header;
    360   STRING_REF        Help;
    361   STRING_REF        Text;
    362   STRING_REF        TextTwo;      // optional text
    363 } EFI_IFR_INVENTORY;
    364 
    365 typedef struct {
    366   EFI_IFR_OP_HEADER Header;
    367   EFI_GUID          Guid;         // GUID for the variable
    368   UINT16            VarId;        // variable store ID, as referenced elsewhere in the form
    369   UINT16            Size;         // size of the variable storage
    370 } EFI_IFR_VARSTORE;
    371 
    372 typedef struct {
    373   EFI_IFR_OP_HEADER Header;
    374   UINT16            VarId;        // variable store ID, as referenced elsewhere in the form
    375 } EFI_IFR_VARSTORE_SELECT;
    376 
    377 //
    378 // Used for the ideqid VFR statement where two variable stores may be referenced in the
    379 // same VFR statement.
    380 // A browser should treat this as an EFI_IFR_VARSTORE_SELECT statement and assume that all following
    381 // IFR opcodes use the VarId as defined here.
    382 //
    383 typedef struct {
    384   EFI_IFR_OP_HEADER Header;
    385   UINT16            VarId;          // variable store ID, as referenced elsewhere in the form
    386   UINT16            SecondaryVarId; // variable store ID, as referenced elsewhere in the form
    387 } EFI_IFR_VARSTORE_SELECT_PAIR;
    388 
    389 typedef struct {
    390   EFI_IFR_OP_HEADER Header;
    391 } EFI_IFR_TRUE;
    392 
    393 typedef struct {
    394   EFI_IFR_OP_HEADER Header;
    395 } EFI_IFR_FALSE;
    396 
    397 typedef struct {
    398   EFI_IFR_OP_HEADER Header;
    399 } EFI_IFR_GT;
    400 
    401 typedef struct {
    402   EFI_IFR_OP_HEADER Header;
    403 } EFI_IFR_GE;
    404 
    405 //
    406 // Save defaults and restore defaults have same structure
    407 //
    408 #define EFI_IFR_RESTORE_DEFAULTS  EFI_IFR_SAVE_DEFAULTS
    409 
    410 typedef struct {
    411   EFI_IFR_OP_HEADER Header;
    412   STRING_REF        Title;        // The string token for the banner title
    413   UINT16            LineNumber;   // 1-based line number
    414   UINT8             Alignment;    // left, center, or right-aligned
    415 } EFI_IFR_BANNER;
    416 
    417 typedef struct {
    418   EFI_IFR_OP_HEADER Header;
    419   UINT16            QuestionId;   // Offset into the map
    420   UINT8             StorageWidth; // Width of the value
    421   CHAR8             Data[1];      // The Data itself
    422 } EFI_IFR_NV_DATA;
    423 
    424 #define EFI_IFR_BANNER_ALIGN_LEFT   0
    425 #define EFI_IFR_BANNER_ALIGN_CENTER 1
    426 #define EFI_IFR_BANNER_ALIGN_RIGHT  2
    427 #define EFI_IFR_BANNER_TIMEOUT      0xFF
    428 
    429 #pragma pack()
    430 
    431 #endif
    432