2.3 VFR Data Struct Definition

vfrDataStructDefinition ::=
 { "typedef" } "struct"
 { StringIdentifier }
 "{" vfrDataStructFields "}"
 { StringIdentifier } ";"

vfrDataStructDefinition ::=
 { "typedef" } "union"
 { StringIdentifier }
 "{" vfrDataStructFields "}"
 { StringIdentifier } ";"

vfrDataStructFields ::=
  (
      dataStructField64
    | dataStructField32
    | dataStructField16
    | dataStructField8
    | dataStructFieldBool
    | dataStructFieldString
    | dataStructFieldDate
    | dataStructFieldTime
    | dataStructFieldRef
    | dataStructFieldUser
    | dataStructBitField64
    | dataStructBitField32
    | dataStructBitField16
    | dataStructBitField8
  )*

dataStructField64 ::=
  "UINT64"
  StringIdentifier { "[" Number "]" } ";"

dataStructField32 ::=
  "UINT32"
  StringIdentifier { "[" Number "]" } ";"

dataStructField16 ::=
  "UINT16"
  StringIdentifier { "[" Number "]" } ";"

dataStructField8 ::=
  "UINT8"
  StringIdentifier { "[" Number "]" } ";"

dataStructFieldBool ::=
  "BOOLEAN"
  StringIdentifier { "[" Number "]" } ";"

dataStructFieldString ::=
  "EFI_STRING_ID"
  StringIdentifier { "[" Number "]" } ";"

dataStructFieldDate ::=
  "EFI_HII_DATE"
  StringIdentifier { "[" Number "]" } ";"

dataStructFieldTime ::=
  "EFI_HII_TIME"
  StringIdentifier { "[" Number "]" } ";"

dataStructFieldRef ::=
  "EFI_HII_REF"
  StringIdentifier { "[" Number "]" } ";"

dataStructFieldUser ::=
  StringIdentifier
  StringIdentifier { "[" Number "]" } ";"

dataStructBitField64 ::=
  "UINT64"
  { StringIdentifier } ":" Number ";"

dataStructBitField32 ::=
  "UINT32"
  { StringIdentifier } ":" Number ";"

dataStructBitField16 ::=
  "UINT16"
  { StringIdentifier } ":" Number ";"

dataStructBitField8 ::=
  "UINT8"
  { StringIdentifier } ":" Number ";"

BEHAVIORS AND RESTRICTIONS

The data structure definition is in C-style language. enum type is not supported. The keyword of the fields' type must be a user defined data structure or one of these types: UINT8, UINT16, UINT32, UINT64, BOOLEAN, EFI_STRING_ID, EFI_HII_DATA, EFI_HII_TIME EFI_HII_REF, and at most one-dimensional array is permitted. Note: for the bit field, the number of the bit width could not exceed 32.

Example

typedef struct {
  UINT8 mU8;
  UINT16 mU16;
  UINT32 mU32[10];
  UINT64 mU64;
} MyData;

typedef union {
  UINT16   Field16;
  UINT8    Field8;
} MyUnionData;

typedef struct {
  UINT16   Field16;
  UINT8    MyBits1 : 1;
  UINT8    MyBits2 : 3;
  UINT8    MyBits3 : 3;
  UINT16   MyBits4 : 4;
} MyBitsData;

Unsupported Example of enum type:

typedef enum {
  MyEnumValue1,
  MyEnumValue2,
  MyEnumValueMax
} MyEnum;

Unsupported Example of two dimensional arrays in data structure:

typedef struct {
  UINT8   mU8;
  UINT32  mU32[10][20];
} MyUnsupportedData;