1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2017 NXP Semiconductors
4 * Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com>
13 * nvme_identify - identify controller or namespace capabilities and status
15 * This issues an identify command to the NVMe controller to return a data
16 * buffer that describes the controller or namespace capabilities and status.
18 * @dev: NVMe controller device
19 * @nsid: 0 for controller, namespace id for namespace to identify
20 * @cns: 1 for controller, 0 for namespace
21 * @dma_addr: dma buffer address to store the identify result
22 * @return: 0 on success, -ETIMEDOUT on command execution timeout,
23 * -EIO on command execution fails
25 int nvme_identify(struct nvme_dev *dev, unsigned nsid,
26 unsigned cns, dma_addr_t dma_addr);
29 * nvme_get_features - retrieve the attributes of the feature specified
31 * This retrieves the attributes of the feature specified.
33 * @dev: NVMe controller device
34 * @fid: feature id to provide data
35 * @nsid: namespace id the command applies to
36 * @dma_addr: data structure used as part of the specified feature
37 * @result: command-specific result in the completion queue entry
38 * @return: 0 on success, -ETIMEDOUT on command execution timeout,
39 * -EIO on command execution fails
41 int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid,
42 dma_addr_t dma_addr, u32 *result);
45 * nvme_set_features - specify the attributes of the feature indicated
47 * This specifies the attributes of the feature indicated.
49 * @dev: NVMe controller device
50 * @fid: feature id to provide data
51 * @dword11: command-specific input parameter
52 * @dma_addr: data structure used as part of the specified feature
53 * @result: command-specific result in the completion queue entry
54 * @return: 0 on success, -ETIMEDOUT on command execution timeout,
55 * -EIO on command execution fails
57 int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11,
58 dma_addr_t dma_addr, u32 *result);
61 * nvme_scan_namespace - scan all namespaces attached to NVMe controllers
63 * This probes all registered NVMe uclass device drivers in the system,
64 * and tries to find all namespaces attached to the NVMe controllers.
66 * @return: 0 on success, -ve on error
68 int nvme_scan_namespace(void);
71 * nvme_print_info - print detailed NVMe controller and namespace information
73 * This prints out detailed human readable NVMe controller and namespace
74 * information which is very useful for debugging.
76 * @udev: NVMe controller device
77 * @return: 0 on success, -EIO if NVMe identify command fails
79 int nvme_print_info(struct udevice *udev);
82 * nvme_get_namespace_id - return namespace identifier
84 * This returns the namespace identifier.
86 * @udev: NVMe controller device
87 * @ns_id: Place where to put the name space identifier
88 * @eui64: Place where to put the IEEE Extended Unique Identifier
89 * @return: 0 on success, -ve on error
91 int nvme_get_namespace_id(struct udevice *udev, u32 *ns_id, u8 *eui64);
93 #endif /* __NVME_H__ */