Blob Blame History Raw
From a160ad75532ee551c4ac21372e2e9a11394f14d4 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 14 Apr 2014 16:49:12 -0400
Subject: [PATCH 03/22] Add support for displaying NVME device paths.

This doesn't actually let you /use/ them yet, but it does show them if
they're there.

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 src/include/efi.h      | 8 ++++++++
 src/lib/unparse_path.c | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/src/include/efi.h b/src/include/efi.h
index fcc52ec..954b4a6 100644
--- a/src/include/efi.h
+++ b/src/include/efi.h
@@ -225,6 +225,14 @@ typedef struct {
 	uint8_t type;
 	uint8_t subtype;
 	uint16_t length;
+	uint32_t namespace_id;
+	uint64_t ieee_extended_unique_identifier;
+} __attribute__((packed)) NVME_DEVICE_PATH;
+
+typedef struct {
+	uint8_t type;
+	uint8_t subtype;
+	uint16_t length;
 	uint32_t reserved;
 	uint64_t node_guid;
 	uint64_t ioc_guid;
diff --git a/src/lib/unparse_path.c b/src/lib/unparse_path.c
index 27e1dbb..ffeda8e 100644
--- a/src/lib/unparse_path.c
+++ b/src/lib/unparse_path.c
@@ -196,6 +196,7 @@ unparse_messaging_path(char *buffer, size_t buffer_size, EFI_DEVICE_PATH *path)
 	I2O_DEVICE_PATH *i2o = (I2O_DEVICE_PATH *)path;
 	IPv4_DEVICE_PATH *ipv4 = (IPv4_DEVICE_PATH *)path;
 /* 	IPv6_DEVICE_PATH *ipv6 = (IPv6_DEVICE_PATH *)path; */
+	NVME_DEVICE_PATH *nvme = (NVME_DEVICE_PATH *)path;
 	char a[16], b[16], c[16], d[16], e[16];
 
 	size_t needed;
@@ -304,6 +305,11 @@ unparse_messaging_path(char *buffer, size_t buffer_size, EFI_DEVICE_PATH *path)
 				get(a, sata->port),
 				get(b, sata->port_multiplier),
 				get(c, sata->lun));
+	case 23:
+		return snprintf(buffer, buffer_size,
+				"NVME(%x,%lx)",
+				get(a, nvme->namespace_id),
+				get(b, nvme->ieee_extended_unique_identifier));
 	default:
 		return unparse_raw(buffer, buffer_size,
 				(uint8_t *)path, path->length);
-- 
1.9.3