Patchwork [2/4] uefi: uefidump: add the SAS Ex subtype-22 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 <1386237847-22648-1-git-send-email-ivan.hu@canonical.com>
Download mbox | patch
Permalink /patch/296756/
State Accepted
Headers show

Comments

Ivan Hu - Dec. 5, 2013, 10:04 a.m.
Add the SAS Ex subtype 22 support on messaging device path follow the section 9.3.5.20 on UEFI spec2.4.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/include/fwts_uefi.h  |   13 +++++++++++--
 src/uefi/uefidump/uefidump.c |    7 +++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
Colin King - Dec. 5, 2013, 11:08 a.m.
On 05/12/13 10:04, Ivan Hu wrote:
> Add the SAS Ex subtype 22 support on messaging device path follow the section 9.3.5.20 on UEFI spec2.4.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |   13 +++++++++++--
>  src/uefi/uefidump/uefidump.c |    7 +++++++
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 84735c2..c83df33 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -208,8 +208,8 @@ typedef enum {
>  	FWTS_UEFI_LOGICAL_UNIT_DEVICE_PATH_SUBTYPE =	(0x11),
>  	FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE = 		(0x12),
>  	FWTS_UEFI_VLAN_DEVICE_PATH_SUBTYPE = 		(0x14),
> -	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15)
> -
> +	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15),
> +	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16)
>  } messaging_dev_path_subtypes;
>  
>  typedef enum {
> @@ -408,6 +408,15 @@ typedef struct {
>  	uint16_t vlanid;
>  } fwts_uefi_vlan_dev_path;
>  
> +
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
> +	uint64_t sas_addr;
> +	uint64_t lun;
> +	uint16_t dev_topology_info;
> +	uint16_t rtp;
> +} __attribute__((packed)) fwts_uefi_sas_ex_dev_path;
> +
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
>  	uint32_t partition_number;
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index b39841b..1be5d60 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -384,6 +384,13 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  				path = uefidump_vprintf(path, "\\DEVICELOGICALUNIT(0x%" PRIx8 ")", l->lun);
>  			}
>  			break;
> +		case FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_uefi_sas_ex_dev_path)) {
> +				fwts_uefi_sas_ex_dev_path *s = (fwts_uefi_sas_ex_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\SASEX(0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx16 ",0x%" PRIx16 ")",
> +					s->sas_addr, s->lun, s->dev_topology_info, s->rtp);
> +			}
> +			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 SAS Ex subtype 22 support on messaging device path follow the section 9.3.5.20 on UEFI spec2.4.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |   13 +++++++++++--
>  src/uefi/uefidump/uefidump.c |    7 +++++++
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 84735c2..c83df33 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -208,8 +208,8 @@ typedef enum {
>  	FWTS_UEFI_LOGICAL_UNIT_DEVICE_PATH_SUBTYPE =	(0x11),
>  	FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE = 		(0x12),
>  	FWTS_UEFI_VLAN_DEVICE_PATH_SUBTYPE = 		(0x14),
> -	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15)
> -
> +	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15),
> +	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16)
>  } messaging_dev_path_subtypes;
>  
>  typedef enum {
> @@ -408,6 +408,15 @@ typedef struct {
>  	uint16_t vlanid;
>  } fwts_uefi_vlan_dev_path;
>  
> +
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
> +	uint64_t sas_addr;
> +	uint64_t lun;
> +	uint16_t dev_topology_info;
> +	uint16_t rtp;
> +} __attribute__((packed)) fwts_uefi_sas_ex_dev_path;
> +
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
>  	uint32_t partition_number;
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index b39841b..1be5d60 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -384,6 +384,13 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  				path = uefidump_vprintf(path, "\\DEVICELOGICALUNIT(0x%" PRIx8 ")", l->lun);
>  			}
>  			break;
> +		case FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_uefi_sas_ex_dev_path)) {
> +				fwts_uefi_sas_ex_dev_path *s = (fwts_uefi_sas_ex_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\SASEX(0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx16 ",0x%" PRIx16 ")",
> +					s->sas_addr, s->lun, s->dev_topology_info, s->rtp);
> +			}
> +			break;
>  		default:
>  			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-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 84735c2..c83df33 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -208,8 +208,8 @@  typedef enum {
 	FWTS_UEFI_LOGICAL_UNIT_DEVICE_PATH_SUBTYPE =	(0x11),
 	FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE = 		(0x12),
 	FWTS_UEFI_VLAN_DEVICE_PATH_SUBTYPE = 		(0x14),
-	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15)
-
+	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15),
+	FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE =		(0x16)
 } messaging_dev_path_subtypes;
 
 typedef enum {
@@ -408,6 +408,15 @@  typedef struct {
 	uint16_t vlanid;
 } fwts_uefi_vlan_dev_path;
 
+
+typedef struct {
+	fwts_uefi_dev_path dev_path;
+	uint64_t sas_addr;
+	uint64_t lun;
+	uint16_t dev_topology_info;
+	uint16_t rtp;
+} __attribute__((packed)) fwts_uefi_sas_ex_dev_path;
+
 typedef struct {
 	fwts_uefi_dev_path dev_path;
 	uint32_t partition_number;
diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index b39841b..1be5d60 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -384,6 +384,13 @@  static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
 				path = uefidump_vprintf(path, "\\DEVICELOGICALUNIT(0x%" PRIx8 ")", l->lun);
 			}
 			break;
+		case FWTS_UEFI_SAS_EX_DEVICE_PATH_SUBTYPE:
+			if (dev_path_len >= sizeof(fwts_uefi_sas_ex_dev_path)) {
+				fwts_uefi_sas_ex_dev_path *s = (fwts_uefi_sas_ex_dev_path *)dev_path;
+				path = uefidump_vprintf(path, "\\SASEX(0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx16 ",0x%" PRIx16 ")",
+					s->sas_addr, s->lun, s->dev_topology_info, s->rtp);
+			}
+			break;
 		default:
 			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
 			break;