summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_device_path.c
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@blueri.se>2019-10-03 16:24:17 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-10-06 16:02:37 +0200
commitf2d247df506eaf984f26ec03baf115d70bd75b9c (patch)
tree0f7f380419c76254588551874dd5712d403b10a4 /lib/efi_loader/efi_device_path.c
parentc50b2883dfc1ce355dc37238741ef97cd2c5d000 (diff)
efi: device path for nvme
This allows our EFI API to create a device path node for NVMe devices. It adds the necessary device path struct, uses the nvme namespace accessor to retrieve the id and eui64, and also provides support for the device path text protocol. Signed-off-by: Patrick Wildt <patrick@blueri.se> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib/efi_loader/efi_device_path.c')
-rw-r--r--lib/efi_loader/efi_device_path.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 86297bb7c1..897fc1b2e8 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -10,6 +10,7 @@
#include <dm.h>
#include <usb.h>
#include <mmc.h>
+#include <nvme.h>
#include <efi_loader.h>
#include <part.h>
#include <sandboxblockdev.h>
@@ -451,6 +452,11 @@ static unsigned dp_size(struct udevice *dev)
return dp_size(dev->parent) +
sizeof(struct efi_device_path_sd_mmc_path);
#endif
+#if defined(CONFIG_NVME)
+ case UCLASS_NVME:
+ return dp_size(dev->parent) +
+ sizeof(struct efi_device_path_nvme);
+#endif
#ifdef CONFIG_SANDBOX
case UCLASS_ROOT:
/*
@@ -584,6 +590,20 @@ static void *dp_fill(void *buf, struct udevice *dev)
return &sddp[1];
}
#endif
+#if defined(CONFIG_NVME)
+ case UCLASS_NVME: {
+ struct efi_device_path_nvme *dp =
+ dp_fill(buf, dev->parent);
+ u32 ns_id;
+
+ dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE;
+ dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_NVME;
+ dp->dp.length = sizeof(*dp);
+ nvme_get_namespace_id(dev, &ns_id, dp->eui64);
+ memcpy(&dp->ns_id, &ns_id, sizeof(ns_id));
+ return &dp[1];
+ }
+#endif
default:
debug("%s(%u) %s: unhandled parent class: %s (%u)\n",
__FILE__, __LINE__, __func__,