Message ID | 1378450773-20612-1-git-send-email-ivan.hu@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 06/09/13 07:59, Ivan Hu wrote: > From: IvanHu <ivan.hu@canonical.com> > > The OsIndicationsSupported variable indicates which of the OS indication features and actions that the firmware supports. > > Signed-off-by: Ivan Hu <ivan.hu@canonical.com> > --- > src/lib/include/fwts_uefi.h | 6 ++++++ > src/uefi/uefidump/uefidump.c | 44 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 50 insertions(+) > > diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h > index c0a6ce5..ecac84d 100644 > --- a/src/lib/include/fwts_uefi.h > +++ b/src/lib/include/fwts_uefi.h > @@ -88,6 +88,12 @@ enum { > > #define FWTS_UEFI_UNSPECIFIED_TIMEZONE 0x07FF > > +#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001 > +#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002 > +#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x0000000000000004 > +#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 > +#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 > + > #if 0 > typedef struct { > char *description; > diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c > index dc576c7..2a34d8e 100644 > --- a/src/uefi/uefidump/uefidump.c > +++ b/src/uefi/uefidump/uefidump.c > @@ -680,6 +680,49 @@ static void uefidump_info_hwerrrec_support(fwts_framework *fw, fwts_uefi_var *va > } > } > > +static void uefidump_info_osindications_supported(fwts_framework *fw, fwts_uefi_var *var) > +{ > + if (var->datalen != 8) { > + /* Should be 8 bytes, of not, dump it out as a hex dump */ > + uefidump_var_hexdump(fw, var); > + } else { > + uint64_t value; > + char str[300]; > + > + memcpy(&value, var->data, sizeof(uint64_t)); > + *str = 0; > + > + if (value & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) > + strcat(str, "EFI_OS_INDICATIONS_BOOT_TO_FW_UI"); ^^ indentation. > + > + if (value & EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION) { > + if (*str) > + strcat(str, ","); > + strcat(str, "EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION"); > + } > + > + if (value & EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED) { > + if (*str) > + strcat(str, ","); > + strcat(str, "EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED"); > + } > + > + if (value & EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED) { > + if (*str) > + strcat(str, ","); > + strcat(str, "EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED"); > + } > + > + if (value & EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED) { > + if (*str) > + strcat(str, ","); > + strcat(str, "EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED"); > + } > + > + fwts_log_info_verbatum(fw, " Value: 0x%16.16" PRIx64 " (%s).", value, str); > + } > +} > + > static uefidump_info uefidump_info_table[] = { > { "PlatformLangCodes", uefidump_info_platform_langcodes }, > { "PlatformLang", uefidump_info_platform_lang }, > @@ -705,6 +748,7 @@ static uefidump_info uefidump_info_table[] = { > { "AcpiGlobalVariable", uefidump_info_acpi_global_variable }, > { "SignatureSupport", uefidump_info_signature_support }, > { "HwErrRecSupport", uefidump_info_hwerrrec_support }, > + { "OsIndicationsSupported", uefidump_info_osindications_supported }, > { NULL, NULL } > }; > >
diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h index c0a6ce5..ecac84d 100644 --- a/src/lib/include/fwts_uefi.h +++ b/src/lib/include/fwts_uefi.h @@ -88,6 +88,12 @@ enum { #define FWTS_UEFI_UNSPECIFIED_TIMEZONE 0x07FF +#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001 +#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002 +#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x0000000000000004 +#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 +#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 + #if 0 typedef struct { char *description; diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c index dc576c7..2a34d8e 100644 --- a/src/uefi/uefidump/uefidump.c +++ b/src/uefi/uefidump/uefidump.c @@ -680,6 +680,49 @@ static void uefidump_info_hwerrrec_support(fwts_framework *fw, fwts_uefi_var *va } } +static void uefidump_info_osindications_supported(fwts_framework *fw, fwts_uefi_var *var) +{ + if (var->datalen != 8) { + /* Should be 8 bytes, of not, dump it out as a hex dump */ + uefidump_var_hexdump(fw, var); + } else { + uint64_t value; + char str[300]; + + memcpy(&value, var->data, sizeof(uint64_t)); + *str = 0; + + if (value & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) + strcat(str, "EFI_OS_INDICATIONS_BOOT_TO_FW_UI"); + + if (value & EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION) { + if (*str) + strcat(str, ","); + strcat(str, "EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION"); + } + + if (value & EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED) { + if (*str) + strcat(str, ","); + strcat(str, "EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED"); + } + + if (value & EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED) { + if (*str) + strcat(str, ","); + strcat(str, "EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED"); + } + + if (value & EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED) { + if (*str) + strcat(str, ","); + strcat(str, "EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED"); + } + + fwts_log_info_verbatum(fw, " Value: 0x%16.16" PRIx64 " (%s).", value, str); + } +} + static uefidump_info uefidump_info_table[] = { { "PlatformLangCodes", uefidump_info_platform_langcodes }, { "PlatformLang", uefidump_info_platform_lang }, @@ -705,6 +748,7 @@ static uefidump_info uefidump_info_table[] = { { "AcpiGlobalVariable", uefidump_info_acpi_global_variable }, { "SignatureSupport", uefidump_info_signature_support }, { "HwErrRecSupport", uefidump_info_hwerrrec_support }, + { "OsIndicationsSupported", uefidump_info_osindications_supported }, { NULL, NULL } };