Patchwork [1/4] uefi: uefidump: add the Device Logical Unit subtype-17 support on messaging device path type for uefidump(LP: #1255387)

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

Comments

Ivan Hu - Dec. 5, 2013, 10:03 a.m.
Add the Device Logical Unit subtype 17 support on messaging device path follow the section 9.3.5.8 on UEFI spec2.4.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/include/fwts_uefi.h  |    6 ++++++
 src/uefi/uefidump/uefidump.c |    6 ++++++
 2 files changed, 12 insertions(+)
Colin King - Dec. 5, 2013, 11:06 a.m.
On 05/12/13 10:03, Ivan Hu wrote:
> Add the Device Logical Unit subtype 17 support on messaging device path follow the section 9.3.5.8 on UEFI spec2.4.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |    6 ++++++
>  src/uefi/uefidump/uefidump.c |    6 ++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index e953bf0..84735c2 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -205,6 +205,7 @@ typedef enum {
>  	FWTS_UEFI_UART_DEVICE_PATH_SUBTYPE =		(0x0e),
>  	FWTS_UEFI_USB_CLASS_DEVICE_PATH_SUBTYPE =	(0x0f),
>  	FWTS_UEFI_USB_WWID_DEVICE_PATH_SUBTYPE =	(0x10),
> +	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)
> @@ -399,6 +400,11 @@ typedef struct {
>  
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
> +	uint8_t lun;
> +} __attribute__((packed)) fwts_uefi_logical_unit_dev_path;
> +
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
>  	uint16_t vlanid;
>  } fwts_uefi_vlan_dev_path;
>  
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index a8b9980..b39841b 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -378,6 +378,12 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  				path = uefidump_vprintf(path, "\\VLAN(0x%" PRIx16 ")", v->vlanid);
>  			}
>  			break;
> +		case FWTS_UEFI_LOGICAL_UNIT_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_uefi_logical_unit_dev_path)) {
> +				fwts_uefi_logical_unit_dev_path *l = (fwts_uefi_logical_unit_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\DEVICELOGICALUNIT(0x%" PRIx8 ")", l->lun);
> +			}
> +			break;
>  		default:
>  			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
>  			break;
> 
Looks good to me.

Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung - Dec. 9, 2013, 4:50 a.m.
On 12/05/2013 06:03 PM, Ivan Hu wrote:
> Add the Device Logical Unit subtype 17 support on messaging device path follow the section 9.3.5.8 on UEFI spec2.4.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |    6 ++++++
>  src/uefi/uefidump/uefidump.c |    6 ++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index e953bf0..84735c2 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -205,6 +205,7 @@ typedef enum {
>  	FWTS_UEFI_UART_DEVICE_PATH_SUBTYPE =		(0x0e),
>  	FWTS_UEFI_USB_CLASS_DEVICE_PATH_SUBTYPE =	(0x0f),
>  	FWTS_UEFI_USB_WWID_DEVICE_PATH_SUBTYPE =	(0x10),
> +	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)
> @@ -399,6 +400,11 @@ typedef struct {
>  
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
> +	uint8_t lun;
> +} __attribute__((packed)) fwts_uefi_logical_unit_dev_path;
> +
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
>  	uint16_t vlanid;
>  } fwts_uefi_vlan_dev_path;
>  
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index a8b9980..b39841b 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -378,6 +378,12 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  				path = uefidump_vprintf(path, "\\VLAN(0x%" PRIx16 ")", v->vlanid);
>  			}
>  			break;
> +		case FWTS_UEFI_LOGICAL_UNIT_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_uefi_logical_unit_dev_path)) {
> +				fwts_uefi_logical_unit_dev_path *l = (fwts_uefi_logical_unit_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\DEVICELOGICALUNIT(0x%" PRIx8 ")", l->lun);
> +			}
> +			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 e953bf0..84735c2 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -205,6 +205,7 @@  typedef enum {
 	FWTS_UEFI_UART_DEVICE_PATH_SUBTYPE =		(0x0e),
 	FWTS_UEFI_USB_CLASS_DEVICE_PATH_SUBTYPE =	(0x0f),
 	FWTS_UEFI_USB_WWID_DEVICE_PATH_SUBTYPE =	(0x10),
+	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)
@@ -399,6 +400,11 @@  typedef struct {
 
 typedef struct {
 	fwts_uefi_dev_path dev_path;
+	uint8_t lun;
+} __attribute__((packed)) fwts_uefi_logical_unit_dev_path;
+
+typedef struct {
+	fwts_uefi_dev_path dev_path;
 	uint16_t vlanid;
 } fwts_uefi_vlan_dev_path;
 
diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index a8b9980..b39841b 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -378,6 +378,12 @@  static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
 				path = uefidump_vprintf(path, "\\VLAN(0x%" PRIx16 ")", v->vlanid);
 			}
 			break;
+		case FWTS_UEFI_LOGICAL_UNIT_DEVICE_PATH_SUBTYPE:
+			if (dev_path_len >= sizeof(fwts_uefi_logical_unit_dev_path)) {
+				fwts_uefi_logical_unit_dev_path *l = (fwts_uefi_logical_unit_dev_path *)dev_path;
+				path = uefidump_vprintf(path, "\\DEVICELOGICALUNIT(0x%" PRIx8 ")", l->lun);
+			}
+			break;
 		default:
 			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
 			break;