EFI_IFR_CHECKBOX
Summary:
Creates a boolean checkbox.
Prototype:
#define EFI_IFR_CHECKBOX_OP 0x06
typedef struct _EFI_IFR_CHECKBOX {
EFI_IFR_OP_HEADER Header;
EFI_IFR_QUESTION_HEADER Question;
UINT8 Flags;
} EFI_IFR_CHECKBOX;
Members:
Header The standard question header, where Header.OpCode = EFI_IFR_CHECKBOX_OP.
Question The standard question header.
Flags Flags that describe the behavior of the question. All undefined bits should be zero.
Description:
Creates a Boolean checkbox question and adds it to the current form. The checkbox has two values:
FALSE if the box is not checked and TRUE if it is.
잊어버린 경우를 대비하여 EFI_IFR_OP_HEADER는 2바이트를 사용하므로 06 8E 05 00 06 00 01 00 00 00 FF FF 00 00에서 06 8E를 사용한다.
이제 나머지 05 00 06 00 01 00 00 00 FF FF 00 00 데이터로 표시되는 EFI_IFR_QUESTION_HEADER 필드를 확인해보자.
EFI_IFR_QUESTION_HEADER
Summary:
Standard question header.
Prototype:
typedef struct _EFI_IFR_QUESTION_HEADER {
EFI_IFR_STATEMENT_HEADER Header;
EFI_QUESTION_ID QuestionId;
EFI_VARSTORE_ID VarStoreId;
union {
EFI_STRING_ID VarName;
UINT16 VarOffset;
} VarStoreInfo;
UINT8 Flags;
} EFI_IFR_QUESTION_HEADER;
Members:
Header The standard statement header.
QuestionId The unique value that identifies the particular question being defined by the opcode. The value of zero is reserved.
Flags A bit-mask that determines which unique settings are active for this question.
VarStoreId Specifies the identifier of a previously declared variable store to use when storing the question’s value.
A value of zero indicates no associated variable store.
VarStoreInfo If VarStoreId refers to Buffer Storage (EFI_IFR_VARSTORE or EFI_IFR_VARSTORE_EFI), then VarStoreInfo contains a 16-bit Buffer Storage offset (VarOffset).
If VarStoreId refers to Name/Value Storage (EFI_IFR_VARSTORE_NAME_VALUE), then VarStoreInfo contains the String ID of the name (VarName) for this name/value pair.
Description:
This is the standard header for questions.
먼저 EFI_IFR_STATEMENT_HEADER이다.
EFI_IFR_STATEMENT_HEADER
Summary:
Standard statement header.
Prototype:
typedef struct _EFI_IFR_STATEMENT_HEADER {
EFI_STRING_ID Prompt;
EFI_STRING_ID Help;
} EFI_IFR_STATEMENT_HEADER;
Members:
Prompt The string identifier of the prompt string for this particular statement. The value 0 indicates no prompt string.
Help The string identifier of the help string for this particular statement. The value 0 indicates no help string.
Description:
This is the standard header for statements, including questions
예를 들어 시스템에서 이름이 MyVariableName이고 EFI_VARIABLE_BOOTSERVICE_ACCESS 플래그가 있는 MyVariableGuid 아래에 있는 특수한 MyCustomStructure 유형으로 UEFI 변수를 나타내려면 다음과 같이 선언해야한다.
EFI_IFR_VARSTORE_EFI
Summary:
Creates a variable storage short-cut for EFI variable storage.
Prototype:
#define EFI_IFR_VARSTORE_EFI_OP 0x26
typedef struct _EFI_IFR_VARSTORE_EFI {
EFI_IFR_OP_HEADER Header;
EFI_VARSTORE_ID VarStoreId;
EFI_GUID Guid;
UINT32 Attributes
UINT16 Size;
//UINT8 Name[];
} EFI_IFR_VARSTORE_EFI;
Members:
Header The byte sequence that defines the type of opcode as well as the length of the opcode being defined. For this tag,
Header.OpCode = EFI_IFR_VARSTORE_EFI_OP.
VarStoreId The variable store identifier, which is unique within the current form set. This field is the value that uniquely identifies
this variable store definition instance from others. Question headers refer to this value to designate which is the active
variable that is being used. A value of zero is invalid.
Guid The EFI variable’s GUID definition. This field comprises one half of the EFI variable name, with the other half being the
human-readable aspect of the name, which is specified in the Name field below.
Attributes Specifies the flags to use for the variable.
Size The size of the variable store.
Name A null-terminated ASCII string that specifies one half of the EFI name for this variable store. The other half is specified in
the Guid field (above). The Name field is not actually included in the structure but is included here to help illustrate the
encoding of the opcode. The size of the string, including the null termination, is included in the opcode's header size.
Description:
This opcode describes an EFI Variable Variable Store within a form set. The Guid and Name specified here will be used with GetVariable() and SetVariable().
바이너리 데이터가 구조체 필드를 채우는 방식을 살펴보자.
EFI_VARSTORE_ID VarStoreId // 01 00
EFI_GUID Guid; // 91 CC 2A EF 50 7B B9 4A AB 67 2B 04 F8 BC 13 5E (= FORMSET_GUID)
UINT32 Attributes // 03 00 00 00
UINT16 Size; // 01 00
//UINT8 Name[]; // 43 68 65 63 6B 62 6F 78 56 61 6C 75 65 00 (= "C h e c k b o x V a l u e")
보다시피 코드는 UEFI 변수에 대한 GUID+ name 조합과 해당 유형 및 플래그를 제공한다.
이제 이 저장소를 참조하는 방식을 알아보자. 우리는 폼에 varid = CheckboxValue를 추가했었다.