Patchwork [1/3] uefi: uefidump: add the Media Protocol subtype-5 support on media device path type for uefidump (LP: #1260147)

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

Comments

Ivan Hu - Dec. 13, 2013, 3:33 a.m.
Add the Media Protocol subtype 5 support on media device path follow
the section 9.3.6.5 on UEFI spec2.4.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/include/fwts_uefi.h  |    5 +++++
 src/uefi/uefidump/uefidump.c |   12 ++++++++++++
 2 files changed, 17 insertions(+)
Colin King - Dec. 13, 2013, 7:19 a.m.
On 13/12/13 03:33, Ivan Hu wrote:
> Add the Media Protocol subtype 5 support on media device path follow
> the section 9.3.6.5 on UEFI spec2.4.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |    5 +++++
>  src/uefi/uefidump/uefidump.c |   12 ++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index eed96f7..e59e9e1 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -463,6 +463,11 @@ typedef struct {
>  
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
> +	fwts_uefi_guid protocol_guid;
> +} __attribute__((packed)) fwts_media_protocol_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 d389551..e333603 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -466,6 +466,18 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  			}
>  			break;
>  		case FWTS_UEFI_PROTOCOL_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_media_protocol_dev_path)) {
> +				fwts_media_protocol_dev_path *m = (fwts_media_protocol_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\MEDIAPROTOCOL("
> +					"%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-"
> +					"%02" PRIx8 "-%02" PRIx8 "-"
> +					"%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 ")",
> +					m->protocol_guid.info1, m->protocol_guid.info2, m->protocol_guid.info3,
> +					m->protocol_guid.info4[0], m->protocol_guid.info4[1], m->protocol_guid.info4[2],
> +					m->protocol_guid.info4[3], m->protocol_guid.info4[4], m->protocol_guid.info4[5],
> +					m->protocol_guid.info4[6], m->protocol_guid.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:13 a.m.
On 12/13/2013 11:33 AM, Ivan Hu wrote:
> Add the Media Protocol subtype 5 support on media device path follow
> the section 9.3.6.5 on UEFI spec2.4.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/lib/include/fwts_uefi.h  |    5 +++++
>   src/uefi/uefidump/uefidump.c |   12 ++++++++++++
>   2 files changed, 17 insertions(+)
>
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index eed96f7..e59e9e1 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -463,6 +463,11 @@ typedef struct {
>
>   typedef struct {
>   	fwts_uefi_dev_path dev_path;
> +	fwts_uefi_guid protocol_guid;
> +} __attribute__((packed)) fwts_media_protocol_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 d389551..e333603 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -466,6 +466,18 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>   			}
>   			break;
>   		case FWTS_UEFI_PROTOCOL_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_media_protocol_dev_path)) {
> +				fwts_media_protocol_dev_path *m = (fwts_media_protocol_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\MEDIAPROTOCOL("
> +					"%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-"
> +					"%02" PRIx8 "-%02" PRIx8 "-"
> +					"%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 ")",
> +					m->protocol_guid.info1, m->protocol_guid.info2, m->protocol_guid.info3,
> +					m->protocol_guid.info4[0], m->protocol_guid.info4[1], m->protocol_guid.info4[2],
> +					m->protocol_guid.info4[3], m->protocol_guid.info4[4], m->protocol_guid.info4[5],
> +					m->protocol_guid.info4[6], m->protocol_guid.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 eed96f7..e59e9e1 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -463,6 +463,11 @@  typedef struct {
 
 typedef struct {
 	fwts_uefi_dev_path dev_path;
+	fwts_uefi_guid protocol_guid;
+} __attribute__((packed)) fwts_media_protocol_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 d389551..e333603 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -466,6 +466,18 @@  static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
 			}
 			break;
 		case FWTS_UEFI_PROTOCOL_DEVICE_PATH_SUBTYPE:
+			if (dev_path_len >= sizeof(fwts_media_protocol_dev_path)) {
+				fwts_media_protocol_dev_path *m = (fwts_media_protocol_dev_path *)dev_path;
+				path = uefidump_vprintf(path, "\\MEDIAPROTOCOL("
+					"%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-"
+					"%02" PRIx8 "-%02" PRIx8 "-"
+					"%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 "-%02" PRIx8 ")",
+					m->protocol_guid.info1, m->protocol_guid.info2, m->protocol_guid.info3,
+					m->protocol_guid.info4[0], m->protocol_guid.info4[1], m->protocol_guid.info4[2],
+					m->protocol_guid.info4[3], m->protocol_guid.info4[4], m->protocol_guid.info4[5],
+					m->protocol_guid.info4[6], m->protocol_guid.info4[7]);
+			}
+			break;
 		default:
 			path = uefidump_vprintf(path, "\\Unknown-MEDIA-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
 			break;