2 * Copyright (C) 2017 NXP Semiconductors
3 * Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com>
5 * SPDX-License-Identifier: GPL-2.0+
14 * nvme_identify - identify controller or namespace capabilities and status
16 * This issues an identify command to the NVMe controller to return a data
17 * buffer that describes the controller or namespace capabilities and status.
19 * @dev: NVMe controller device
20 * @nsid: 0 for controller, namespace id for namespace to identify
21 * @cns: 1 for controller, 0 for namespace
22 * @dma_addr: dma buffer address to store the identify result
23 * @return: 0 on success, -ETIMEDOUT on command execution timeout,
24 * -EIO on command execution fails
26 int nvme_identify(struct nvme_dev *dev, unsigned nsid,
27 unsigned cns, dma_addr_t dma_addr);
30 * nvme_get_features - retrieve the attributes of the feature specified
32 * This retrieves the attributes of the feature specified.
34 * @dev: NVMe controller device
35 * @fid: feature id to provide data
36 * @nsid: namespace id the command applies to
37 * @dma_addr: data structure used as part of the specified feature
38 * @result: command-specific result in the completion queue entry
39 * @return: 0 on success, -ETIMEDOUT on command execution timeout,
40 * -EIO on command execution fails
42 int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid,
43 dma_addr_t dma_addr, u32 *result);
46 * nvme_set_features - specify the attributes of the feature indicated
48 * This specifies the attributes of the feature indicated.
50 * @dev: NVMe controller device
51 * @fid: feature id to provide data
52 * @dword11: command-specific input parameter
53 * @dma_addr: data structure used as part of the specified feature
54 * @result: command-specific result in the completion queue entry
55 * @return: 0 on success, -ETIMEDOUT on command execution timeout,
56 * -EIO on command execution fails
58 int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11,
59 dma_addr_t dma_addr, u32 *result);
62 * nvme_scan_namespace - scan all namespaces attached to NVMe controllers
64 * This probes all registered NVMe uclass device drivers in the system,
65 * and tries to find all namespaces attached to the NVMe controllers.
67 * @return: 0 on success, -ve on error
69 int nvme_scan_namespace(void);
72 * nvme_print_info - print detailed NVMe controller and namespace information
74 * This prints out detailed human readable NVMe controller and namespace
75 * information which is very useful for debugging.
77 * @udev: NVMe controller device
78 * @return: 0 on success, -EIO if NVMe identify command fails
80 int nvme_print_info(struct udevice *udev);
82 #endif /* __NVME_H__ */