ACK: [PATCH 2/3][Resend] uefi: uefidump: add support for Driver#### (LP:#1237263)

Alex Hung alex.hung at canonical.com
Wed Oct 16 03:17:56 UTC 2013


On 10/14/2013 06:11 PM, Ivan Hu wrote:
> Add support for Driver#### - Each Driver#### variable contains
> an EFI_LOAD_OPTION. Each load option variable is appended with
> a unique number, for example Driver0001, Driver0002, etc.
>
> This patch also modify the defination of FWTS_UEFI_LOAD_ACTIVE
> correspond to the UEFI spec.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>   src/lib/include/fwts_uefi.h  |    3 ++-
>   src/uefi/uefidump/uefidump.c |   42 +++++++++++++++++++++++++++++++++++++++++-
>   2 files changed, 43 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index ecac84d..d38903e 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -20,7 +20,8 @@
>   #ifndef __FWTS_UEFI_H__
>   #define __FWTS_UEFI_H__
>
> -#define FWTS_UEFI_LOAD_ACTIVE 0x00000001
> +#define FWTS_UEFI_LOAD_OPTION_ACTIVE 		0x00000001
> +#define FWTS_UEFI_LOAD_OPTION_FORCE_RECONNECT 	0x00000002
>
>   typedef struct {
>   	uint16_t	*varname;
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index 04519d7..b414ca9 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -508,7 +508,7 @@ static void uefidump_info_bootdev(fwts_framework *fw, fwts_uefi_var *var)
>   	int len;
>
>   	fwts_log_info_verbatum(fw, "  Active: %s\n",
> -		(load_option->attributes & FWTS_UEFI_LOAD_ACTIVE) ? "Yes" : "No");
> +		(load_option->attributes & FWTS_UEFI_LOAD_OPTION_ACTIVE) ? "Yes" : "No");
>   	fwts_uefi_str16_to_str(tmp, sizeof(tmp), load_option->description);
>   	len = fwts_uefi_str16len(load_option->description);
>   	fwts_log_info_verbatum(fw, "  Info: %s\n", tmp);
> @@ -745,6 +745,38 @@ static void uefidump_info_driverorder(fwts_framework *fw, fwts_uefi_var *var)
>   	free(str);
>   }
>
> +static void uefidump_info_driverdev(fwts_framework *fw, fwts_uefi_var *var)
> +{
> +	fwts_uefi_load_option *load_option = (fwts_uefi_load_option *)var->data;
> +	char *path;
> +	char *tmp;
> +	size_t len;
> +
> +	fwts_log_info_verbatum(fw, "  Force Reconnect: %s\n",
> +		(load_option->attributes & FWTS_UEFI_LOAD_OPTION_FORCE_RECONNECT) ? "Yes" : "No");
> +
> +	len = fwts_uefi_str16len(load_option->description);
> +	
> +	if (len != 0) {
> +		tmp = malloc(len + 1);
> +		if (tmp) {
> +			fwts_uefi_str16_to_str(tmp, len + 1, load_option->description);
> +			fwts_log_info_verbatum(fw, "  Info: %s\n", tmp);
> +			free(tmp);
> +		}
> +	}
> +
> +	if (load_option->file_path_list_length != 0) {
> +		/* Skip over description to get to packed path, unpack path and print */
> +		path = (char *)var->data + sizeof(load_option->attributes) +
> +			sizeof(load_option->file_path_list_length) +
> +			(sizeof(uint16_t) * (len + 1));
> +		path = uefidump_build_dev_path(NULL, (fwts_uefi_dev_path *)path);
> +		fwts_log_info_verbatum(fw, "  Path: %s.", path);
> +		free(path);
> +	}
> +}
> +
>   static uefidump_info uefidump_info_table[] = {
>   	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
>   	{ "PlatformLang",	uefidump_info_platform_lang },
> @@ -804,6 +836,14 @@ static void uefidump_var(fwts_framework *fw, fwts_uefi_var *var)
>   		return;
>   	}
>
> +	/* Check the driver load option Driver####. #### is a printed hex value */
> +	if ((strlen(varname) == 10) && (strncmp(varname, "Driver", 6) == 0)
> +			&& isxdigit(varname[6]) && isxdigit(varname[7])
> +			&& isxdigit(varname[8]) && isxdigit(varname[9])) {
> +		uefidump_info_driverdev(fw, var);
> +		return;
> +	}
> +
>   	/* otherwise just do a plain old hex dump */
>   	uefidump_var_hexdump(fw, var);
>   }
>

Acked-by: Alex Hung <alex.hung at canonical.com>

-- 
Cheers,
Alex Hung



More information about the fwts-devel mailing list