[PATCH 2/3] uefi: uefidump: Add support for OsIndicationsSupported

Colin Ian King colin.king at canonical.com
Thu Sep 5 08:35:31 UTC 2013


On 05/09/13 09:27, Ivan Hu wrote:
> The OsIndicationsSupported variable indicates which of the OS indication features and actions that the firmware supports.
> 
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |    6 ++++++
>  src/uefi/uefidump/uefidump.c |   43 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 49 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..fd5e378 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -680,6 +680,48 @@ 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 */

Should there be a uefidump_var_hexdump() there?

> +	} else {
> +		uint64_t value;
> +		static char str[300];

I'd prefer this not to be static. It's fine to be on the stack.

> +
> +		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 +747,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 }
>  };
>  
> 




More information about the fwts-devel mailing list