date and time VFR elements don't support generic question flags


Konstantin Aladyshev
 

According to the UEFI specification EFI_IFR_DATE and EFI_IFR_TIME are
just generic types of questions that by default have no relation to
the system Date/Time.
Shouldn't EDKII support it like that?

Best regards,
Konstantin Aladyshev

On Sat, Oct 8, 2022 at 5:34 AM gaoliming <gaoliming@...> wrote:

Date and Time are related to system Date/Time. They have no usage with interactive.

Thanks
Liming
-----邮件原件-----
发件人: Konstantin Aladyshev <aladyshev22@...>
发送时间: 2022年9月30日 20:03
收件人: discuss <discuss@edk2.groups.io>; Liming Gao
<gaoliming@...>
主题: date and time VFR elements don't support generic question flags

Hello!

I was investigating 'EFI_HII_CONFIG_ACCESS_PROTOCOL.Callback()'
functionality and found out that it is not possible to set the
INTERACTIVE flag on the 'data' and 'time' elements. I've started to
investigate the issue and it looks like these elements don't support
any generic question flags (READ_ONLY, RESET_REQUIRED, ...). Moreover,
according to the VFR specification, although these elements are
generic questions it is not possible to set generic flags for them.
And it looks to me like a conflict with UEFI specification, which
doesn't say anything specific about the fact that these elements
shouldn't support generic question flags. Is this a bug in VFR
specification/EDKII implementation?

Here is more deep analysis of the problem:

All VFR questions have EFI_IFR_QUESTION_HEADER in their encoding. This
includes such VFR elements as 'checkbox', 'numeric', 'string',
'oneof', 'orderedlist', 'date', 'time'.

The EFI_IFR_QUESTION_HEADER structure has a Flags field:
```
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;
```

This field currently supports these options:
```
#define EFI_IFR_FLAG_READ_ONLY 0x01
#define EFI_IFR_FLAG_CALLBACK 0x04
#define EFI_IFR_FLAG_RESET_REQUIRED 0x10
#define EFI_IFR_FLAG_REST_STYLE 0x20
#define EFI_IFR_FLAG_RECONNECT_REQUIRED 0x40
#define EFI_IFR_FLAG_OPTIONS_ONLY 0x80
```
In the VFR code they are set with a help of keywords:
```
READ_ONLY
INTERACTIVE
RESET_REQUIRED
REST_STYLE
RECONNECT_REQUIRED
OPTIONS_ONLY
```

It is possible to set these flags on 'checkbox', 'numeric', 'string',
'oneof' and 'orderedlist' elements.

But although 'data' and 'time' elements have the
EFI_IFR_QUESTION_HEADER:
```
typedef struct _EFI_IFR_DATE {
EFI_IFR_OP_HEADER Header;
EFI_IFR_QUESTION_HEADER Question;
UINT8 Flags;
} EFI_IFR_DATE;

typedef struct _EFI_IFR_TIME {
EFI_IFR_OP_HEADER Header;
EFI_IFR_QUESTION_HEADER Question;
UINT8 Flags;
} EFI_IFR_TIME;
```
It is not possible to set generic question flags for them.

For example the following VFR code will not build:
```
date
varid = FormData.DateValue,
prompt = STRING_TOKEN(DATE_PROMPT),
help = STRING_TOKEN(DATE_HELP),
flags = INTERACTIVE,
default = 2021/05/22,
enddate;
```

Moreover it looks like it is not just an EDKII problem. The VFR
specification also forbids that:
https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf
/211_vfr_form_definition?q=questionheaderFlagsField#2.11.6.10-vfr-time-sta
tement-definition
https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf
/211_vfr_form_definition?q=questionheaderFlagsField#2.11.6.9-vfr-date-stat
ement-definition
```
timeFlagsField ::=
Number
| "HOUR_SUPPRESS"
| "MINUTE_SUPPRESS"
| "SECOND_SUPPRESS"
| "STORAGE_NORMAL"
| "STORAGE_TIME"
| "STORAGE_WAKEUP"

dateFlagsField ::=
Number
| "YEAR_SUPPRESS"
| "MONTH_SUPPRESS"
| "DAY_SUPPRESS"
| "STORAGE_NORMAL"
| "STORAGE_TIME"
| "STORAGE_WAKEUP"
```
Both of these elements lack 'questionheaderFlagsField' that
encapsulates the generic question flags:
https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf
/210_vfr_general_token_definition#2.10.5-vfr-question-header-definition
```
questionheaderFlagsField ::=
"READ_ONLY"
| "INTERACTIVE"
| "RESET_REQUIRED"
| "OPTIONS_ONLY"
| "REST_STYLE"
```

For example compare this with the 'checkboxFlagsField':
```
checkboxFlagsField ::=
Number
| "CHECKBOX_DEFAULT"
| "CHECKBOX_DEFAULT_MFG"
| questionheaderFlagsField <-----------
```

Best regards,
Konstantin Aladyshev