Patchwork [3/3] uefi: uefidump: add the PIWG Firmware Volume subtype-7 support on media device path type for uefidump (LP: #1260147)

login
register
mail settings
Submitter Ivan Hu
Date Dec. 13, 2013, 3:34 a.m.
Message ID <1386905646-24291-1-git-send-email-ivan.hu@canonical.com>
Download mbox | patch
Permalink /patch/300871/
State Accepted
Headers show

Comments

Ivan Hu - Dec. 13, 2013, 3:34 a.m.
Add the PIWG Firmware Volume subtype 7 support on media device path follow
the section 9.3.6.7 on UEFI spec2.4. And the Firmware Volume Name is a GUID,
which is defined in the UEFI PI spec(vol.2_DXE, section 8.2).

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/include/fwts_uefi.h  |    8 +++++++-
 src/uefi/uefidump/uefidump.c |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
Colin King - Dec. 13, 2013, 7:21 a.m.
On 13/12/13 03:34, Ivan Hu wrote:
> Add the PIWG Firmware Volume subtype 7 support on media device path follow
> the section 9.3.6.7 on UEFI spec2.4. And the Firmware Volume Name is a GUID,
> which is defined in the UEFI PI spec(vol.2_DXE, section 8.2).
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |    8 +++++++-
>  src/uefi/uefidump/uefidump.c |   13 +++++++++++++
>  2 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 8d71048..dd9bbb0 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -220,7 +220,8 @@ typedef enum {
>  	FWTS_UEFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE =	(0x03),
>  	FWTS_UEFI_FILE_PATH_DEVICE_PATH_SUBTYPE =	(0x04),
>  	FWTS_UEFI_PROTOCOL_DEVICE_PATH_SUBTYPE =	(0x05),
> -	FWTS_UEFI_PIWG_FW_FILE_DEVICE_PATH_SUBTYPE =	(0x06)
> +	FWTS_UEFI_PIWG_FW_FILE_DEVICE_PATH_SUBTYPE =	(0x06),
> +	FWTS_UEFI_PIWG_FW_VOLUME_DEVICE_PATH_SUBTYPE =	(0x07)
>  } media_dev_path_subtypes;
>  
>  typedef enum {
> @@ -474,6 +475,11 @@ typedef struct {
>  
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
> +	fwts_uefi_guid fw_volume_name;
> +} __attribute__((packed)) fwts_piwg_fw_volume_dev_path;
> +
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
>  	uint16_t device_type;
>  	uint16_t status_flags;
>    	char description[0];
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index 50ee1e3..8beb179 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -491,6 +491,19 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  					p->fw_file_name.info4[6], p->fw_file_name.info4[7]);
>  			}
>  			break;
> +		case FWTS_UEFI_PIWG_FW_VOLUME_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_piwg_fw_volume_dev_path)) {
> +				fwts_piwg_fw_volume_dev_path *p = (fwts_piwg_fw_volume_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\FV("
> +					"%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-"
> +					"%02" PRIx8 "-%02" PRIx8 "-"
> +					"%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 ")",
> +					p->fw_volume_name.info1, p->fw_volume_name.info2, p->fw_volume_name.info3,
> +					p->fw_volume_name.info4[0], p->fw_volume_name.info4[1], p->fw_volume_name.info4[2],
> +					p->fw_volume_name.info4[3], p->fw_volume_name.info4[4], p->fw_volume_name.info4[5],
> +					p->fw_volume_name.info4[6], p->fw_volume_name.info4[7]);
> +			}
> +			break;
>  		default:
>  			path = uefidump_vprintf(path, "\\Unknown-MEDIA-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
>  			break;
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung - Dec. 23, 2013, 6:14 a.m.
On 12/13/2013 11:34 AM, Ivan Hu wrote:
> Add the PIWG Firmware Volume subtype 7 support on media device path follow
> the section 9.3.6.7 on UEFI spec2.4. And the Firmware Volume Name is a GUID,
> which is defined in the UEFI PI spec(vol.2_DXE, section 8.2).
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/lib/include/fwts_uefi.h  |    8 +++++++-
>   src/uefi/uefidump/uefidump.c |   13 +++++++++++++
>   2 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 8d71048..dd9bbb0 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -220,7 +220,8 @@ typedef enum {
>   	FWTS_UEFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE =	(0x03),
>   	FWTS_UEFI_FILE_PATH_DEVICE_PATH_SUBTYPE =	(0x04),
>   	FWTS_UEFI_PROTOCOL_DEVICE_PATH_SUBTYPE =	(0x05),
> -	FWTS_UEFI_PIWG_FW_FILE_DEVICE_PATH_SUBTYPE =	(0x06)
> +	FWTS_UEFI_PIWG_FW_FILE_DEVICE_PATH_SUBTYPE =	(0x06),
> +	FWTS_UEFI_PIWG_FW_VOLUME_DEVICE_PATH_SUBTYPE =	(0x07)
>   } media_dev_path_subtypes;
>
>   typedef enum {
> @@ -474,6 +475,11 @@ typedef struct {
>
>   typedef struct {
>   	fwts_uefi_dev_path dev_path;
> +	fwts_uefi_guid fw_volume_name;
> +} __attribute__((packed)) fwts_piwg_fw_volume_dev_path;
> +
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
>   	uint16_t device_type;
>   	uint16_t status_flags;
>     	char description[0];
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index 50ee1e3..8beb179 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -491,6 +491,19 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>   					p->fw_file_name.info4[6], p->fw_file_name.info4[7]);
>   			}
>   			break;
> +		case FWTS_UEFI_PIWG_FW_VOLUME_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_piwg_fw_volume_dev_path)) {
> +				fwts_piwg_fw_volume_dev_path *p = (fwts_piwg_fw_volume_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\FV("
> +					"%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-"
> +					"%02" PRIx8 "-%02" PRIx8 "-"
> +					"%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 ")",
> +					p->fw_volume_name.info1, p->fw_volume_name.info2, p->fw_volume_name.info3,
> +					p->fw_volume_name.info4[0], p->fw_volume_name.info4[1], p->fw_volume_name.info4[2],
> +					p->fw_volume_name.info4[3], p->fw_volume_name.info4[4], p->fw_volume_name.info4[5],
> +					p->fw_volume_name.info4[6], p->fw_volume_name.info4[7]);
> +			}
> +			break;
>   		default:
>   			path = uefidump_vprintf(path, "\\Unknown-MEDIA-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
>   			break;
>


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

Patch

diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
index 8d71048..dd9bbb0 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -220,7 +220,8 @@  typedef enum {
 	FWTS_UEFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE =	(0x03),
 	FWTS_UEFI_FILE_PATH_DEVICE_PATH_SUBTYPE =	(0x04),
 	FWTS_UEFI_PROTOCOL_DEVICE_PATH_SUBTYPE =	(0x05),
-	FWTS_UEFI_PIWG_FW_FILE_DEVICE_PATH_SUBTYPE =	(0x06)
+	FWTS_UEFI_PIWG_FW_FILE_DEVICE_PATH_SUBTYPE =	(0x06),
+	FWTS_UEFI_PIWG_FW_VOLUME_DEVICE_PATH_SUBTYPE =	(0x07)
 } media_dev_path_subtypes;
 
 typedef enum {
@@ -474,6 +475,11 @@  typedef struct {
 
 typedef struct {
 	fwts_uefi_dev_path dev_path;
+	fwts_uefi_guid fw_volume_name;
+} __attribute__((packed)) fwts_piwg_fw_volume_dev_path;
+
+typedef struct {
+	fwts_uefi_dev_path dev_path;
 	uint16_t device_type;
 	uint16_t status_flags;
   	char description[0];
diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index 50ee1e3..8beb179 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -491,6 +491,19 @@  static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
 					p->fw_file_name.info4[6], p->fw_file_name.info4[7]);
 			}
 			break;
+		case FWTS_UEFI_PIWG_FW_VOLUME_DEVICE_PATH_SUBTYPE:
+			if (dev_path_len >= sizeof(fwts_piwg_fw_volume_dev_path)) {
+				fwts_piwg_fw_volume_dev_path *p = (fwts_piwg_fw_volume_dev_path *)dev_path;
+				path = uefidump_vprintf(path, "\\FV("
+					"%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-"
+					"%02" PRIx8 "-%02" PRIx8 "-"
+					"%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 ")",
+					p->fw_volume_name.info1, p->fw_volume_name.info2, p->fw_volume_name.info3,
+					p->fw_volume_name.info4[0], p->fw_volume_name.info4[1], p->fw_volume_name.info4[2],
+					p->fw_volume_name.info4[3], p->fw_volume_name.info4[4], p->fw_volume_name.info4[5],
+					p->fw_volume_name.info4[6], p->fw_volume_name.info4[7]);
+			}
+			break;
 		default:
 			path = uefidump_vprintf(path, "\\Unknown-MEDIA-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
 			break;