搜尋此網誌

顯示具有 Visual Forms Representation(VFR) 標籤的文章。 顯示所有文章
顯示具有 Visual Forms Representation(VFR) 標籤的文章。 顯示所有文章

2012年8月22日 星期三

Visual Forms Representation(VFR) - checkbox


[checkbox]
布林值的詢問,這些允許抉擇真(1)或假(0)。
這詢問值是布林代數。一般而言,為了構成詢問以致於提示文字要求得到在‘yes/enabled/on’為‘true’與‘no/disabled/off’為‘false’。
布林值的詢問可能被顯示如同一個"Check box"、無線按鈕、選擇表、選單、下拉選單。

語法:
checkbox
    [ name = identifier , ]
    [ varid = storage-id , ]
    [ questionid = uint , ]
    prompt = string ,
    help = string ,
    [ flags = check-box-flags , ]
    [ key = uint , ]
 question-option-list
endcheckbox ;
checkbox-flags := checkbox-flags | checkbox-flag |
                  checkbox-flag |
                 
checkbox-flag  := uint8 |
                  CHECKBOX_DEFAULT |
                  CHECKBOX_DEFAULT_MFG |
                  READ_ONLY |
                  INTERACTIVE |
                  OPTIONS_ONLY |
                  RESET_REQUIRED

屬性:
questionid:此唯一值得識別碼在這個系統上。在表單排版範圍內。這詢問識別符號,在裝置路徑以外與排版識別符號唯一識別的分析在系統範圍內。此預設值為0。
prompt:詢問提示字串。
help: 顯示輔助操作字串。
flag:零或更多關鍵字、整數區隔藉由'|'符號。後面緊接著關鍵字描述:
CHECKBOX_DEFAULT:是否被標明,這標準定義是'TRUE'對於'Check Box'.否則它將會是'FALSE'。如果這裡有一套疊項目(option)或定義(default)它是標準定義值對於'Check Box'的詢問,此外此flag是被忽略。
CHECKBOX_DEFAULT_MFG:是否被標明,這製造商的定義是'TRUE'對於'Check Box'.否則它將會是'FALSE'。如果這裡有一套疊項目(option)或定義(default)它是製造商的定義值對於'Check Box'的詢問,此外此flag是被忽略。
READ_ONLY: 唯讀,此值將不能被改變與選擇。
INTERACTIVE: 關聯的函式程式,將被呼叫。
OPTIONS_ONLY: 只有此值明確說明經由相互套疊選項操作能被使用者選擇。
RESET_REQUIRED: 一個系統重置被依照次序要求去改變,當這詢問值生效。

描述:
建立一個布林checkbox的詢問與增加它到當前的表單。此checkbox有兩個值:FALSE當這個匣沒被查核與TRUE是有。
這裡有三個方法明確說明定義對於詢問:在Flags區(最低優先權),一個或多個疊項目(option)運算元或一個疊定義(default)運算元(最高優先權)。
一個圖像可能被關聯與一個詢問使用一個疊圖像運算。
這運算式符合IFR EFI_IFR_CHECKBOX。

2012年8月16日 星期四

Visual Forms Representation(VFR) - AND/OR/NOT

[and]


[or]

[not]
反相

範例:
suppressif NOT ideqval NVData.DeviceEn_0 == 0x1
    AND NOT ideqval NVData.DeviceEn_1 == 0x1
    AND NOT ideqval NVData.DeviceEn_2 == 0x1
    OR ideqval NVData.SupportDevChoice == 0x0
    OR ideqval NVData.DeviceTypeInput == 0x5;
        oneof varid  = NVData.Conf,                

                prompt      =    STRING_TOKEN(MV_STR_OPTION_TEST_STR),
                help        = STRING_TOKEN(MV_STR_DEVICE_TYPE_SLECT_HELP),
                option text = STRING_TOKEN(MV_STR_OPTION_NO_STRING), value = 0x1001, flags = DEFAULT | INTERACTIVE;
                option text = STRING_TOKEN(MV_STR_OPTION_YES_STRING), value =
0x1002, flags = INTERACTIVE;
            endoneof;

endif;

Visual Forms Representation(VFR) - catenate

[catenate]
語法:

catenate ( expression0 , expression1 )

參數:
expression0, expression1 字串或緩衝區表示。

描述:
  • 如果第一與第二表示不能被鑑定如同一串字串或一個緩衝區,回傳未下定義。
  • 如果第一與第二表示是屬於不同型態,回傳未下定義。
  • 如果第一與第二表示是字串,回傳一串新字串,它包含第一串字串內容(沒有NULL終止符號)接在第二串字串內容。
  • 如果第一與第二表示是緩衝區,回傳一個新緩衝區,它包含第一個緩衝區內容接在第二個緩衝區內容。
這運算式符合EFI_IFR_CATENATE。

Visual Forms Representation(VFR) - banner

[banner]
語法:
banner
   title = string , line uint16 , align align-flags ;
   title = string , timeout = uint16 ;

align-flags := left | center | right

描述:
此運算式不符合任何IFR運算和被Forms Browser忽略。

範例:
banner
  title = STRING_TOKEN(STR_BANNER_TEXT),
  line 1,
  align left;

banner
  timeout = 100;

Visual Forms Representation(VFR) - boolval

[boolval]
轉換無號整數、字串或緩衝區表示成一個布林值。

語法:
boolval ( expression )

參數:
expression     表示轉換

描述:
此運算式轉換(expression)到一個布林值。如果(expression)鑑定為未定義,然後它將回傳未下定義。
  • 如果轉換從一個無號整數表示,零將被轉換為FALSE與任何其他值將被轉換成TRUE。
  • 如果轉換從一個字串,如果此字串(沒有大小寫之分)是"true",然後回傳TRUE。如果此字串(沒有大小寫之分)是"false",然後回傳FALSE。否則它將回傳未下定義。
  • 如果轉換從一個緩衝區,如果此緩衝區是全為零,將回傳是FALSE,否則將回傳是TRUE。
  • 如果轉換從任何其他資料型態,將回傳未下定義。

這運算式符合IFR EFI_IFR_TO_BOOLEAN。

Visual Forms Representation(VFR) - bitwisenot

[bitwisenot]
Bitwise NOT (~)運算元屬於一個無號整數符號。

語法:
bitwisenot ( expression )

參數:
expression     表示求一個無號整數的數值。

描述:
此運算元執行一個bitwise NOT屬於一個無號整數符號。
如果此符號不能被鑑定當作一個無號整數,回傳未下定義,否則,將零延伸至64-bits無號整數,bitwise-NOT它與回傳它。
這運算式符合IFR EFI_IFR_BITWISE_NOT。

2012年8月14日 星期二

Visual Forms Representation(VFR) - action


[action]
[Action Button]是按鈕,它會造成一個預先定義配置字串立即去處理。這按鈕沒有儲存直接的關聯。

語法:
action
   [ name = identifier , ]
   [ questionid = uint , ]
   prompt = STRING_TOKEN(string) ,
   help = STRING_TOKEN(string),
   [ flags = action-flags , ]
   config = STRING_TOKEN(string),
   question-tag-list
endaction ;

參數:
action-flag = READ_ONLY |
                INTERACTIVE |
                OPTIONS_ONLY |
                RESET_REQUIRED

questionid:一個無號16-bit整數,唯一識別碼在此系統上。
prompt:詢問提示字串。
help: 顯示輔助操作字串。

READ_ONLY: 唯讀,此值將不能被改變與選擇。
INTERACTIVE: 關聯的函式程式,將被呼叫。
OPTIONS_ONLY: 只有此值明確說明經由相互套疊選項操作能被使用者選擇。
RESET_REQUIRED: 一個系統重置被依照次序要求去改變,當這詢問值生效。

描述:
操作建立一個作用詢問。當這個詢問被選擇,它的配置字串將被處理,相關訊息經由config詳細指明。如果config沒有指示任何訊息,當沒有配置字串,那就不會有任何處理。
這是有效的當只使用[action button]作為回訪使用。

如果這個詢問被標記成read-only,他將不能被選擇。
這運算式符合IFR EFI_IFR_ACTION。


範例:
action 
  prompt = STRING_TOKEN(STR_ACTION_TEXT), 
  help = STRING_TOKEN(STR_ACTION_HELP), 
  flags = INTERACTIVE
 config = STRING_TOKEN(STR_ACTION_CONFIG), 
endaction;

2012年8月7日 星期二

Visual Forms Representation(VFR) commands Table


You could refer to: Visual Forms Representation File Format
/*
 * EfiVfrParser: P a r s e r  S u p p o r t
 *
 * Generated from: C:\Edk\Sample\Tools\Source\UefiVfrCompile\VfrSyntax.g
 */
const ANTLRChar *EfiVfrParser::tokenName(int tok)   { return _token_tbl[tok]; }

const ANTLRChar *EfiVfrParser::_token_tbl[]={
/* 00 */ "Invalid",
/* 01 */ "@",
/* 02 */ "TheString",
/* 03 */ "~[\\n]*",
/* 04 */ "\\n",
/* 05 */ "//",
/* 06 */ "[\\ \\t]",
/* 07 */ "\\n",
/* 08 */ "extern",
/* 09 */ "formpkgtype",
/* 10 */ "{",
/* 11 */ "}",
/* 12 */ "(",
/* 13 */ ")",
/* 14 */ "[",
/* 15 */ "]",
/* 16 */ "LineDefinition",
/* 17 */ "devicepath",
/* 18 */ "formset",
/* 19 */ "formsetid",
/* 20 */ "endformset",
/* 21 */ "title",
/* 22 */ "formid",
/* 23 */ "oneof",
/* 24 */ "endoneof",
/* 25 */ "prompt",
/* 26 */ "orderedlist",
/* 27 */ "maxcontainers",
/* 28 */ "endlist",
/* 29 */ "endform",
/* 30 */ "form",
/* 31 */ "subtitle",
/* 32 */ "help",
/* 33 */ "text",
/* 34 */ "option",
/* 35 */ "flags",
/* 36 */ "date",
/* 37 */ "enddate",
/* 38 */ "year",
/* 39 */ "month",
/* 40 */ "day",
/* 41 */ "time",
/* 42 */ "endtime",
/* 43 */ "hour",
/* 44 */ "minute",
/* 45 */ "second",
/* 46 */ "grayoutif",
/* 47 */ "label",
/* 48 */ "timeout",
/* 49 */ "inventory",
/* 50 */ "_NON_NV_DATA_MAP",
/* 51 */ "struct",
/* 52 */ "BOOLEAN",
/* 53 */ "UINT64",
/* 54 */ "UINT32",
/* 55 */ "UINT16",
/* 56 */ "CHAR16",
/* 57 */ "UINT8",
/* 58 */ "guid",
/* 59 */ "checkbox",
/* 60 */ "endcheckbox",
/* 61 */ "numeric",
/* 62 */ "endnumeric",
/* 63 */ "minimum",
/* 64 */ "maximum",
/* 65 */ "step",
/* 66 */ "default",
/* 67 */ "password",
/* 68 */ "endpassword",
/* 69 */ "string",
/* 70 */ "endstring",
/* 71 */ "minsize",
/* 72 */ "maxsize",
/* 73 */ "encoding",
/* 74 */ "suppressif",
/* 75 */ "disableif",
/* 76 */ "hidden",
/* 77 */ "goto",
/* 78 */ "formsetguid",
/* 79 */ "inconsistentif",
/* 80 */ "nosubmitif",
/* 81 */ "endif",
/* 82 */ "key",
/* 83 */ "DEFAULT",
/* 84 */ "MANUFACTURING",
/* 85 */ "INTERACTIVE", /*The callback associated with this form will be called.*/
/* 86 */ "NV_ACCESS",
/* 87 */ "RESET_REQUIRED", /*A system reset is required in order for changes in this question's value to take effect.*/
/* 88 */ "LATE_CHECK",
/* 89 */ "READ_ONLY", /*The question is read-only. The value cannot be changed and cannot be selected.*/
/* 90 */ "OPTIONS_ONLY", /*Only the values specified by nested option operators can be selected by the user.*/
/* 91 */ "class",
/* 92 */ "subclass",
/* 93 */ "classguid",
/* 94 */ "typedef",
/* 95 */ "restore",
/* 96 */ "save",
/* 97 */ "defaults",
/* 98 */ "banner",
/* 99 */ "align",
/* 100 */ "left",
/* 101 */ "right",
/* 102 */ "center",
/* 103 */ "line",
/* 104 */ "name",
/* 105 */ "varid",
/* 106 */ "question",
/* 107 */ "questionid",
/* 108 */ "image",
/* 109 */ "locked",
/* 110 */ "rule",
/* 111 */ "endrule",
/* 112 */ "value",
/* 113 */ "resetbutton",
/* 114 */ "endresetbutton",
/* 115 */ "defaultstore",
/* 116 */ "attribute",
/* 117 */ "varstore",
/* 118 */ "efivarstore",
/* 119 */ "varsize",
/* 120 */ "namevaluevarstore",
/* 121 */ "action",
/* 122 */ "config",
/* 123 */ "endaction",
/* 124 */ "refresh",
/* 125 */ "interval",
/* 126 */ "varstoredevice",
/* 127 */ "NONDEVICE",
/* 128 */ "DISK_DEVICE",
/* 129 */ "VIDEO_DEVICE",
/* 130 */ "NETWORK_DEVICE",
/* 131 */ "INPUT_DEVICE",
/* 132 */ "ONBOARD_DEVICE",
/* 133 */ "OTHER_DEVICE",
/* 134 */ "SETUP_APPLICATION",
/* 135 */ "GENERAL_APPLICATION",
/* 136 */ "FRONT_PAGE",
/* 137 */ "SINGLE_USE",
/* 138 */ "show",
/* 139 */ "push",
/* 140 */ "pop",
/* 141 */ ",",
/* 142 */ "string identifier",
/* 143 */ "numeric value",
/* 144 */ "\\#pragma",
/* 145 */ "pack",
/* 146 */ ";",
/* 147 */ "EFI_STRING_ID",
/* 148 */ "EFI_HII_DATE",
/* 149 */ "EFI_HII_TIME",
/* 150 */ "=",
/* 151 */ "STRING_TOKEN",
/* 152 */ "\\|",
/* 153 */ ".",
/* 154 */ "TRUE",
/* 155 */ "FALSE",
/* 156 */ "ONE",
/* 157 */ "ONES",
/* 158 */ "ZERO",
/* 159 */ ":",
/* 160 */ "/",
/* 161 */ "HORIZONTAL",
/* 162 */ "CHECKBOX_DEFAULT",
/* 163 */ "CHECKBOX_DEFAULT_MFG",
/* 164 */ "YEAR_SUPPRESS",
/* 165 */ "MONTH_SUPPRESS",
/* 166 */ "DAY_SUPPRESS",
/* 167 */ "STORAGE_NORMAL",
/* 168 */ "STORAGE_TIME",
/* 169 */ "STORAGE_WAKEUP",
/* 170 */ "NUMERIC_SIZE_1",
/* 171 */ "NUMERIC_SIZE_2",
/* 172 */ "NUMERIC_SIZE_4",
/* 173 */ "NUMERIC_SIZE_8",
/* 174 */ "DISPLAY_INT_DEC",
/* 175 */ "DISPLAY_UINT_DEC",
/* 176 */ "DISPLAY_UINT_HEX",
/* 177 */ "MULTI_LINE",
/* 178 */ "UNIQUE",
/* 179 */ "NOEMPTY",
/* 180 */ "HOUR_SUPPRESS",
/* 181 */ "MINUTE_SUPPRESS",
/* 182 */ "SECOND_SUPPRESS",
/* 183 */ "IMAGE_TOKEN",
/* 184 */ "OPTION_DEFAULT",
/* 185 */ "OPTION_DEFAULT_MFG",
/* 186 */ "dup",
/* 187 */ "vareqval",
/* 188 */ "var",
/* 189 */ "ideqval",
/* 190 */ "ideqid",
/* 191 */ "ideqvallist",
/* 192 */ "questionref",
/* 193 */ "ruleref",
/* 194 */ "stringref",
/* 195 */ "pushthis",
/* 196 */ "UNDEFINED",
/* 197 */ "VERSOPM",
/* 198 */ "length",
/* 199 */ "AND",
/* 200 */ "OR",
/* 201 */ "NOT",
/* 202 */ "~",
/* 203 */ "boolval",
/* 204 */ "stringval",
/* 205 */ "unintval",
/* 206 */ "toupper",
/* 207 */ "tolower",
/* 208 */ "match",
/* 209 */ "catenate",
/* 210 */ "questionrefval",
/* 211 */ "stringrefval",
/* 212 */ "&",
/* 213 */ "==",
/* 214 */ "!=",
/* 215 */ "<",
/* 216 */ "<=",
/* 217 */ ">",
/* 218 */ ">=",
/* 219 */ "\\<<",
/* 220 */ "\\>>",
/* 221 */ "\\+",
/* 222 */ "\\-",
/* 223 */ "\\*",
/* 224 */ "%",
/* 225 */ "Path",
/* 226 */ "Format",
/* 227 */ "cond",
/* 228 */ "find",
/* 229 */ "mid",
/* 230 */ "token",
/* 231 */ "span",
/* 232 */ "?",
/* 233 */ "SENSITIVE",
/* 234 */ "INSENSITIVE",
/* 235 */ "LAST_NON_MATCH",
/* 236 */ "FIRST_NON_MATCH"
};


/*The source code is from EFI Dev Kit(EDk).*/


(EFI_STRING Request)Append OFFSET/WIDTH/VALUE items at the beginning of string.


/*The source code is from EFI Dev Kit(EDk).*/
/*It will append a request string with string. and its layout as below:*/


Word(2bytes)
Length
Description
0
8 Words(16 Bytes)
“&OFFSET=”
8
L1 Words(L1 x 2 Bytes)
Offset Length
8 + L1
7 Words(14 Bytes)
“&WIDTH=”
15 + L1
L2 Words(L2 x 2 Bytes)
Width Length
15 + L1 + L2
7 Words(14 Bytes)
“&VALUE=”
22 + L1 + L2
L3 Words(L2 x 3 Bytes)
Value Length


UINTN
AppendOffsetWidthValue (
  IN OUT CHAR16               *String,
  IN UINTN                    Offset,
  IN UINTN                    Width,
  IN UINT8                    *Block
  )
/*++
Routine Description:
  Append OFFSET/WIDTH/VALUE items at the beginning of string.

Arguments:
  String -         Point to the position should be appended.
  Offset -         Offset value.
  Width  -         Width value.
  Block  -         Point to data buffer.

Returns:
  The count of unicode character was appended.
--*/
{
  CHAR16                      *OriString;

  OriString = String;

  StrCpy (String, L"&OFFSET=");
  String += StrLen (L"&OFFSET=");
  String += SPrint (String, 0, L"%x", Offset);

  StrCpy (String,L"&WIDTH=");
  String += StrLen (L"&WIDTH=");
  String += SPrint (String, 0, L"%x", Width);

  if (Block != NULL) {
    StrCpy (String,L"&VALUE=");
    String += StrLen (L"&VALUE=");
    while ((Width--) != 0) {
      String += SPrint (String, 0, L"%x", Block[Width]);
    }
  }

  return String - OriString;
}

(EFI_STRING Request)Construct using routing information GUID/NAME/PATH.


/*The source code is from EFI Dev Kit(EDk).*/
/*It will make a string. and its layout as below:*/

Word(2bytes)
Length
Description
0
5 Words(10 Bytes)
“GUID=”
5
16 Words(32 Bytes)
EFI_GUID
21
6 Words(12 Bytes)
“&NAME=”
27
00 + “??”=2Words x L1(L1 x 4 = 4L1 Bytes)
00??, 00??, 00??.....
27 + 2L1
6 Words(12 Bytes)
“&PATH=”
33 + 2L1
Word(2 bytes) x L2 = 2L2bytes
Device Path Size
(33 + 2L1 + L2)Last Word
1 Words(2 Bytes)
00


CHAR16 *
ConstructConfigHdr (
  IN EFI_GUID                *Guid,
  IN CHAR16                  *Name,
  IN EFI_HANDLE              DriverHandle
  )
/*++

Routine Description:
  Construct using routing information GUID/NAME/PATH.

Arguments:
  Guid          - Routing information: GUID.
  Name          - Routing information: NAME.
  DriverHandle  - Driver handle which contains the routing information: PATH.

Returns:
  NULL  - Fails.
  Other - Pointer to configHdr string.

--*/
{
  EFI_STATUS                 Status;
  CHAR16                     *ConfigHdr;
  EFI_DEVICE_PATH_PROTOCOL   *DevicePath;
  CHAR16                     *String;
  CHAR16                     *UpperString;
  UINTN                      Index;
  UINT8                      *Buffer;
  UINTN                      DevicePathLength;
  UINTN                      NameLength;

  //
  // Get the device path from handle installed EFI HII Config Access protocol
  //
  Status = BS->HandleProtocol (
                 DriverHandle,
                 &gEfiDevicePathProtocolGuid,
                 (VOID **) &DevicePath
                 );
  if (EFI_ERROR (Status)) {
    return NULL;
  }

  DevicePathLength = DevicePathSize (DevicePath);
  NameLength = StrLen (Name);
  ConfigHdr = AllocateZeroPool ((5 + sizeof (EFI_GUID) * 2 + 6 + NameLength * 4 + 6 + DevicePathLength * 2 + 1) * sizeof (CHAR16));
  if (ConfigHdr == NULL) {
    return NULL;
  } 

  String = ConfigHdr;
  StrCpy (String, L"GUID=");
  String += StrLen (L"GUID=");

  //
  // Append Guid converted to 32
  //
  UpperString = String;
  for (Index = 0, Buffer = (UINT8 *)Guid; Index < sizeof (EFI_GUID); Index++) {
    String += SPrint (String, 0, L"%02x", *Buffer++);
  }
  *String = 0;
  StrLwr (UpperString);

  //
  // Append L"&NAME="
  //
  StrCpy (String, L"&NAME=");
  String += StrLen (L"&NAME=");
  UpperString = String;
  for (Index = 0; Index < NameLength ; Index++) {
    String += SPrint (String, 0, L"00%x", Name[Index]);
  }
  *String = 0;
  StrLwr (UpperString);
  
  //
  // Append L"&PATH="
  //
  StrCpy (String, L"&PATH=");
  String += StrLen (L"&PATH=");
  UpperString = String;
  for (Index = 0, Buffer = (UINT8 *) DevicePath; Index < DevicePathLength; Index++) {
    String += SPrint (String, 0, L"%02x", *Buffer++);
  }
  *String = 0;
  StrLwr (UpperString);

  return ConfigHdr;
}

2012年8月2日 星期四

Return number of ASCii string

int
strlen(
    IN const char * s
)
/*++
Routine Description:
  This function returns the number of ASCii characters in the ASCii string s.
 Arguments: 
  Str     - Pointer to the null-terminated string to get length            str will hold the trimmed string. 
Returns:
--*/

{
const char *sc;

for (sc = s; *sc != '\0'; ++sc)
/* nothing */;
return (int)((unsigned long long)sc - (unsigned long long)s);
}

Convert the ASCII string <=> a UNICODE string


/************************************************************/
CHAR16 *
AsciiStrToUnicodeStr (
  IN  CHAR8   *Source,
  OUT CHAR16  *Destination
  )
/*++
Routine Description:
  Convert the ASCII string into a UNICODE string.
Arguments:
  Source      - The ASCII string.
  Destination - The storage to return the UNICODE string.
Returns:
  Pointer to the UNICODE string.
--*/
{
  ASSERT (Destination != NULL);
  ASSERT (Source != NULL);

  while (*Source != '\0') {
    *(Destination++) = (CHAR16) *(Source++);
  }

  *Destination = '\0';

  return Destination;
}
/************************************************************/

/************************************************************/
CHAR8 *
UnicodeStrToAsciiStr (
  IN  CHAR16   *Source,
  OUT  CHAR8  *Destination
  )
/*++
Routine Description:
  Convert the UNICODE string into a ASCII  string.
Arguments:
  Source      - The storage to return the UNICODE string.
  Destination - The ASCII string.
Returns:
  Pointer to the UNICODE string.
--*/

{
  ASSERT (Destination != NULL);
  ASSERT (Source != NULL);

  while (*Source != '\0') {
    *(Destination++) = (CHAR8) *(Source++);
  }

  *Destination = '\0';

  return Destination;
}

/************************************************************/