diff mbox

[2/4] uefi: uefidump: add the SATA subtype-18 support on messaging device path type for uefidump(LP#:1255387)

Message ID 1385532557-30917-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Nov. 27, 2013, 6:09 a.m. UTC
Add the SATA subtype 18 support on messaging device path follow the section 9.3.5.6 on UEFI spec2.4.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/include/fwts_uefi.h  |    8 ++++++++
 src/uefi/uefidump/uefidump.c |    7 +++++++
 2 files changed, 15 insertions(+)

Comments

Colin Ian King Nov. 27, 2013, 12:23 p.m. UTC | #1
On 27/11/13 06:09, Ivan Hu wrote:
> Add the SATA subtype 18 support on messaging device path follow the section 9.3.5.6 on UEFI spec2.4.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h  |    8 ++++++++
>  src/uefi/uefidump/uefidump.c |    7 +++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 40a171a..4d45f25 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -204,6 +204,7 @@ typedef enum {
>  	FWTS_UEFI_IPV6_DEVICE_PATH_SUBTYPE =		(0x0d),
>  	FWTS_UEFI_UART_DEVICE_PATH_SUBTYPE =		(0x0e),
>  	FWTS_UEFI_USB_CLASS_DEVICE_PATH_SUBTYPE =	(0x0f),
> +	FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE = 		(0x12),
>  	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15)
>  
>  } messaging_dev_path_subtypes;
> @@ -381,6 +382,13 @@ typedef struct {
>  
>  typedef struct {
>  	fwts_uefi_dev_path dev_path;
> +	uint16_t hbapn;
> +	uint16_t pmpn;
> +	uint16_t lun;
> +} fwts_uefi_sata_dev_path;
> +
> +typedef struct {
> +	fwts_uefi_dev_path dev_path;
>  	uint32_t partition_number;
>  	uint64_t partition_start;
>  	uint64_t partition_size;
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index 93b47dd..9dd209e 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -342,6 +342,13 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>  				path = uefidump_vprintf(path, "\\FIBREEX(0x%" PRIx64 ",0x%" PRIx64 ")", f->wwn, f->lun);
>  			}
>  			break;
> +		case FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE:
> +			if (dev_path_len >= sizeof(fwts_uefi_sata_dev_path)) {
> +				fwts_uefi_sata_dev_path *s = (fwts_uefi_sata_dev_path *)dev_path;
> +				path = uefidump_vprintf(path, "\\SATA(0x%" PRIx16 ",0x%" PRIx16 ",0x%" PRIx16 ")",
> +					s->hbapn, s->pmpn, s->lun);
> +			}
> +			break;
>  		default:
>  			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
>  			break;
> 

Checked it with the spec, looks good to me.

Keng-Yu, can you re-work the patch subject line before applying this.
There should be a space before the "(LP" text, and the text should be
.."uefidump (LP: #1255387)" and not "uefidump(LP#:1255387)"

Acked-by: Colin Ian King <colin.king@canonical.com>
Keng-Yu Lin Dec. 3, 2013, 3:22 a.m. UTC | #2
On Wed, Nov 27, 2013 at 8:23 PM, Colin Ian King
<colin.king@canonical.com> wrote:
> On 27/11/13 06:09, Ivan Hu wrote:
>> Add the SATA subtype 18 support on messaging device path follow the section 9.3.5.6 on UEFI spec2.4.
>>
>> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
>> ---
>>  src/lib/include/fwts_uefi.h  |    8 ++++++++
>>  src/uefi/uefidump/uefidump.c |    7 +++++++
>>  2 files changed, 15 insertions(+)
>>
>> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
>> index 40a171a..4d45f25 100644
>> --- a/src/lib/include/fwts_uefi.h
>> +++ b/src/lib/include/fwts_uefi.h
>> @@ -204,6 +204,7 @@ typedef enum {
>>       FWTS_UEFI_IPV6_DEVICE_PATH_SUBTYPE =            (0x0d),
>>       FWTS_UEFI_UART_DEVICE_PATH_SUBTYPE =            (0x0e),
>>       FWTS_UEFI_USB_CLASS_DEVICE_PATH_SUBTYPE =       (0x0f),
>> +     FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE =            (0x12),
>>       FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15)
>>
>>  } messaging_dev_path_subtypes;
>> @@ -381,6 +382,13 @@ typedef struct {
>>
>>  typedef struct {
>>       fwts_uefi_dev_path dev_path;
>> +     uint16_t hbapn;
>> +     uint16_t pmpn;
>> +     uint16_t lun;
>> +} fwts_uefi_sata_dev_path;
>> +
>> +typedef struct {
>> +     fwts_uefi_dev_path dev_path;
>>       uint32_t partition_number;
>>       uint64_t partition_start;
>>       uint64_t partition_size;
>> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
>> index 93b47dd..9dd209e 100644
>> --- a/src/uefi/uefidump/uefidump.c
>> +++ b/src/uefi/uefidump/uefidump.c
>> @@ -342,6 +342,13 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
>>                               path = uefidump_vprintf(path, "\\FIBREEX(0x%" PRIx64 ",0x%" PRIx64 ")", f->wwn, f->lun);
>>                       }
>>                       break;
>> +             case FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE:
>> +                     if (dev_path_len >= sizeof(fwts_uefi_sata_dev_path)) {
>> +                             fwts_uefi_sata_dev_path *s = (fwts_uefi_sata_dev_path *)dev_path;
>> +                             path = uefidump_vprintf(path, "\\SATA(0x%" PRIx16 ",0x%" PRIx16 ",0x%" PRIx16 ")",
>> +                                     s->hbapn, s->pmpn, s->lun);
>> +                     }
>> +                     break;
>>               default:
>>                       path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
>>                       break;
>>
>
> Checked it with the spec, looks good to me.
>
> Keng-Yu, can you re-work the patch subject line before applying this.
> There should be a space before the "(LP" text, and the text should be
> .."uefidump (LP: #1255387)" and not "uefidump(LP#:1255387)"
>
> Acked-by: Colin Ian King <colin.king@canonical.com>
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
index 40a171a..4d45f25 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -204,6 +204,7 @@  typedef enum {
 	FWTS_UEFI_IPV6_DEVICE_PATH_SUBTYPE =		(0x0d),
 	FWTS_UEFI_UART_DEVICE_PATH_SUBTYPE =		(0x0e),
 	FWTS_UEFI_USB_CLASS_DEVICE_PATH_SUBTYPE =	(0x0f),
+	FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE = 		(0x12),
 	FWTS_UEFI_FIBRE_CHANNEL_EX_DEVICE_PATH_SUBTYPE = (0x15)
 
 } messaging_dev_path_subtypes;
@@ -381,6 +382,13 @@  typedef struct {
 
 typedef struct {
 	fwts_uefi_dev_path dev_path;
+	uint16_t hbapn;
+	uint16_t pmpn;
+	uint16_t lun;
+} fwts_uefi_sata_dev_path;
+
+typedef struct {
+	fwts_uefi_dev_path dev_path;
 	uint32_t partition_number;
 	uint64_t partition_start;
 	uint64_t partition_size;
diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index 93b47dd..9dd209e 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -342,6 +342,13 @@  static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
 				path = uefidump_vprintf(path, "\\FIBREEX(0x%" PRIx64 ",0x%" PRIx64 ")", f->wwn, f->lun);
 			}
 			break;
+		case FWTS_UEFI_SATA_DEVICE_PATH_SUBTYPE:
+			if (dev_path_len >= sizeof(fwts_uefi_sata_dev_path)) {
+				fwts_uefi_sata_dev_path *s = (fwts_uefi_sata_dev_path *)dev_path;
+				path = uefidump_vprintf(path, "\\SATA(0x%" PRIx16 ",0x%" PRIx16 ",0x%" PRIx16 ")",
+					s->hbapn, s->pmpn, s->lun);
+			}
+			break;
 		default:
 			path = uefidump_vprintf(path, "\\Unknown-MESSAGING-DEV-PATH(0x%" PRIx8 ")", dev_path->subtype);
 			break;