From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- ...me-add-accessor-to-namespace-id-and-eui64.patch | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 bsp/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-qoriq-lx2160acex7/0010-nvme-add-accessor-to-namespace-id-and-eui64.patch (limited to 'bsp/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-qoriq-lx2160acex7/0010-nvme-add-accessor-to-namespace-id-and-eui64.patch') diff --git a/bsp/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-qoriq-lx2160acex7/0010-nvme-add-accessor-to-namespace-id-and-eui64.patch b/bsp/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-qoriq-lx2160acex7/0010-nvme-add-accessor-to-namespace-id-and-eui64.patch new file mode 100644 index 00000000..d8de8a38 --- /dev/null +++ b/bsp/meta-freescale-3rdparty/recipes-bsp/u-boot/u-boot-qoriq-lx2160acex7/0010-nvme-add-accessor-to-namespace-id-and-eui64.patch @@ -0,0 +1,90 @@ +From 89dbced60971ec1d01386b0457c20e045cbfe5ad Mon Sep 17 00:00:00 2001 +From: Patrick Wildt +Date: Thu, 3 Oct 2019 13:48:47 +0200 +Subject: [PATCH 10/17] nvme: add accessor to namespace id and eui64 + +This adds a function which can be used by e.g. EFI to retrieve +the namespace identifier and EUI64. For that it adds the EUI64 +to its driver internal namespace structure and copies the EUI64 +during namespace identification. + +Upstream-Status: Backport [Solid-Run BSP] + +Signed-off-by: Patrick Wildt +Tested-by: Heinrich Schuchardt +Reviewed-by: Bin Meng +(cherry picked from commit c50b2883dfc1ce355dc37238741ef97cd2c5d000) +Signed-off-by: Olof Johansson +--- + drivers/nvme/nvme.c | 13 +++++++++++++ + drivers/nvme/nvme.h | 1 + + include/nvme.h | 12 ++++++++++++ + 3 files changed, 26 insertions(+) + +diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c +index 47f101e280..ee6b581d9e 100644 +--- a/drivers/nvme/nvme.c ++++ b/drivers/nvme/nvme.c +@@ -621,6 +621,18 @@ static int nvme_get_info_from_identify(struct nvme_dev *dev) + return 0; + } + ++int nvme_get_namespace_id(struct udevice *udev, u32 *ns_id, u8 *eui64) ++{ ++ struct nvme_ns *ns = dev_get_priv(udev); ++ ++ if (ns_id) ++ *ns_id = ns->ns_id; ++ if (eui64) ++ memcpy(eui64, ns->eui64, sizeof(ns->eui64)); ++ ++ return 0; ++} ++ + int nvme_scan_namespace(void) + { + struct uclass *uc; +@@ -657,6 +669,7 @@ static int nvme_blk_probe(struct udevice *udev) + if (nvme_identify(ndev, ns->ns_id, 0, (dma_addr_t)(long)id)) + return -EIO; + ++ memcpy(&ns->eui64, &id->eui64, sizeof(id->eui64)); + flbas = id->flbas & NVME_NS_FLBAS_LBA_MASK; + ns->flbas = flbas; + ns->lba_shift = id->lbaf[flbas].ds; +diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h +index 922f7abfe8..0e8cb221a7 100644 +--- a/drivers/nvme/nvme.h ++++ b/drivers/nvme/nvme.h +@@ -637,6 +637,7 @@ struct nvme_ns { + struct list_head list; + struct nvme_dev *dev; + unsigned ns_id; ++ u8 eui64[8]; + int devnum; + int lba_shift; + u8 flbas; +diff --git a/include/nvme.h b/include/nvme.h +index 2c3d14d241..2cdf8ce320 100644 +--- a/include/nvme.h ++++ b/include/nvme.h +@@ -78,4 +78,16 @@ int nvme_scan_namespace(void); + */ + int nvme_print_info(struct udevice *udev); + ++/** ++ * nvme_get_namespace_id - return namespace identifier ++ * ++ * This returns the namespace identifier. ++ * ++ * @udev: NVMe controller device ++ * @ns_id: Place where to put the name space identifier ++ * @eui64: Place where to put the IEEE Extended Unique Identifier ++ * @return: 0 on success, -ve on error ++ */ ++int nvme_get_namespace_id(struct udevice *udev, u32 *ns_id, u8 *eui64); ++ + #endif /* __NVME_H__ */ +-- +2.17.1 + -- cgit 1.2.3-korg