Patchwork [4/4] uefi: uefidump: add the NVM Express namespace subtype-23 support on messaging device path type for uefidump (LP: #1255387)

login
register
mail settings
Submitter Ivan Hu
Date Dec. 5, 2013, 10:04 a.m.
Message ID <1386237876-22722-1-git-send-email-ivan.hu@canonical.com>
Download mbox | patch
Permalink /patch/296758/
State Accepted
Headers show

Comments

Ivan Hu - Dec. 5, 2013, 10:04 a.m.
Add the NVM Express Namespace subtype 23 support on messaging device path follow the section 9.3.5.22 on UEFI spec2.4.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/include/fwts_uefi.h  |    9 ++++++++-
 src/uefi/uefidump/uefidump.c |    7 +++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
Colin King - Dec. 5, 2013, 11:13 a.m.
On 05/12/13 10:04, Ivan Hu wrote:
> Add the NVM Express Namespace subtype 23 support on messaging device path follow the section 9.3.5.22 on UEFI spec2.4.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |    9 ++++++++-
>  src/uefi/uefidump/uefidump.c |    7 +++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 864ce43..c834d28 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -210,7 +210,8 @@ typedef enum {
>  	FWTS_UEFI_ISCSI_DEVICE_PATH_SUBTYPE = 		(0x13),
>  	FWTS_UEFI_VLAN_DEVICE_PATH_SUBTYPE = 		(0x14),
>  	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15),
> -	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16)
> +	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16),
> +	FWTS_UEFI_NVM_EXPRESS_NAMESP_DEVICE_PATH_SUBTYPE = (0x17)
>  } messaging_dev_path_subtypes;
>  
>  typedef enum {
> @@ -425,6 +426,12 @@ typedef struct {
>  	uint16_t tpg_tag;
>  	char iscsi_tn[0];
>  } __attribute__((packed)) fwts_uefi_iscsi_dev_path;
> + 
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
> +	uint32_t namesp_id;
> +	uint64_t ext_unique_id;
> +} __attribute__((packed)) fwts_uefi_nvm_express_namespace_dev_path;
>  
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index e965043..d389551 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -406,6 +406,13 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  				path = uefidump_vprintf(path, ",%s)", i->iscsi_tn);
>  			}
>  			break;
> +		case FWTS_UEFI_NVM_EXPRESS_NAMESP_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_uefi_nvm_express_namespace_dev_path)) {
> +				fwts_uefi_nvm_express_namespace_dev_path *n = (fwts_uefi_nvm_express_namespace_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\NVMEXPRESS(0x%" PRIx32 ",0x%" PRIx64 ")",
> +					n->namesp_id, n->ext_unique_id);
> +			}
> +			break;
>  		default:
>  			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
>  			break;
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung - Dec. 9, 2013, 4:51 a.m.
On 12/05/2013 06:04 PM, Ivan Hu wrote:
> Add the NVM Express Namespace subtype 23 support on messaging device path follow the section 9.3.5.22 on UEFI spec2.4.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |    9 ++++++++-
>  src/uefi/uefidump/uefidump.c |    7 +++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 864ce43..c834d28 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -210,7 +210,8 @@ typedef enum {
>  	FWTS_UEFI_ISCSI_DEVICE_PATH_SUBTYPE = 		(0x13),
>  	FWTS_UEFI_VLAN_DEVICE_PATH_SUBTYPE = 		(0x14),
>  	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15),
> -	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16)
> +	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16),
> +	FWTS_UEFI_NVM_EXPRESS_NAMESP_DEVICE_PATH_SUBTYPE = (0x17)
>  } messaging_dev_path_subtypes;
>  
>  typedef enum {
> @@ -425,6 +426,12 @@ typedef struct {
>  	uint16_t tpg_tag;
>  	char iscsi_tn[0];
>  } __attribute__((packed)) fwts_uefi_iscsi_dev_path;
> + 
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
> +	uint32_t namesp_id;
> +	uint64_t ext_unique_id;
> +} __attribute__((packed)) fwts_uefi_nvm_express_namespace_dev_path;
>  
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index e965043..d389551 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -406,6 +406,13 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  				path = uefidump_vprintf(path, ",%s)", i->iscsi_tn);
>  			}
>  			break;
> +		case FWTS_UEFI_NVM_EXPRESS_NAMESP_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_uefi_nvm_express_namespace_dev_path)) {
> +				fwts_uefi_nvm_express_namespace_dev_path *n = (fwts_uefi_nvm_express_namespace_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\NVMEXPRESS(0x%" PRIx32 ",0x%" PRIx64 ")",
> +					n->namesp_id, n->ext_unique_id);
> +			}
> +			break;
>  		default:
>  			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
>  			break;
> 


cked-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 864ce43..c834d28 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -210,7 +210,8 @@  typedef enum {
 	FWTS_UEFI_ISCSI_DEVICE_PATH_SUBTYPE = 		(0x13),
 	FWTS_UEFI_VLAN_DEVICE_PATH_SUBTYPE = 		(0x14),
 	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15),
-	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16)
+	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16),
+	FWTS_UEFI_NVM_EXPRESS_NAMESP_DEVICE_PATH_SUBTYPE = (0x17)
 } messaging_dev_path_subtypes;
 
 typedef enum {
@@ -425,6 +426,12 @@  typedef struct {
 	uint16_t tpg_tag;
 	char iscsi_tn[0];
 } __attribute__((packed)) fwts_uefi_iscsi_dev_path;
+ 
+typedef struct {
+	fwts_uefi_dev_path dev_path;
+	uint32_t namesp_id;
+	uint64_t ext_unique_id;
+} __attribute__((packed)) fwts_uefi_nvm_express_namespace_dev_path;
 
 typedef struct {
 	fwts_uefi_dev_path dev_path;
diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index e965043..d389551 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -406,6 +406,13 @@  static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
 				path = uefidump_vprintf(path, ",%s)", i->iscsi_tn);
 			}
 			break;
+		case FWTS_UEFI_NVM_EXPRESS_NAMESP_DEVICE_PATH_SUBTYPE:
+			if (dev_path_len >= sizeof(fwts_uefi_nvm_express_namespace_dev_path)) {
+				fwts_uefi_nvm_express_namespace_dev_path *n = (fwts_uefi_nvm_express_namespace_dev_path *)dev_path;
+				path = uefidump_vprintf(path, "\\NVMEXPRESS(0x%" PRIx32 ",0x%" PRIx64 ")",
+					n->namesp_id, n->ext_unique_id);
+			}
+			break;
 		default:
 			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
 			break;