blob: f6b9f7fb707ea08cfa43c8c90554cfc5182a3a0e [file] [log] [blame]
Christopher Ferris05d08e92016-02-04 13:16:38 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef __NDCTL_H__
20#define __NDCTL_H__
21#include <linux/types.h>
Christopher Ferris106b3a82016-08-24 12:15:38 -070022struct nd_cmd_dimm_flags {
Christopher Ferris05d08e92016-02-04 13:16:38 -080023 __u32 status;
24 __u32 flags;
25} __packed;
26struct nd_cmd_get_config_size {
Christopher Ferris05d08e92016-02-04 13:16:38 -080027 __u32 status;
28 __u32 config_size;
29 __u32 max_xfer;
30} __packed;
Christopher Ferris05d08e92016-02-04 13:16:38 -080031struct nd_cmd_get_config_data_hdr {
32 __u32 in_offset;
33 __u32 in_length;
34 __u32 status;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070035 __u8 out_buf[];
Christopher Ferris05d08e92016-02-04 13:16:38 -080036} __packed;
37struct nd_cmd_set_config_hdr {
38 __u32 in_offset;
Christopher Ferris05d08e92016-02-04 13:16:38 -080039 __u32 in_length;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070040 __u8 in_buf[];
Christopher Ferris05d08e92016-02-04 13:16:38 -080041} __packed;
42struct nd_cmd_vendor_hdr {
Christopher Ferris05d08e92016-02-04 13:16:38 -080043 __u32 opcode;
44 __u32 in_length;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070045 __u8 in_buf[];
Christopher Ferris05d08e92016-02-04 13:16:38 -080046} __packed;
Christopher Ferris05d08e92016-02-04 13:16:38 -080047struct nd_cmd_vendor_tail {
48 __u32 status;
49 __u32 out_length;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070050 __u8 out_buf[];
Christopher Ferris05d08e92016-02-04 13:16:38 -080051} __packed;
52struct nd_cmd_ars_cap {
53 __u64 address;
54 __u64 length;
Christopher Ferris05d08e92016-02-04 13:16:38 -080055 __u32 status;
Christopher Ferris106b3a82016-08-24 12:15:38 -070056 __u32 max_ars_out;
57 __u32 clear_err_unit;
Christopher Ferris1308ad32017-11-14 17:32:13 -080058 __u16 flags;
59 __u16 reserved;
Christopher Ferris106b3a82016-08-24 12:15:38 -070060} __packed;
Christopher Ferris106b3a82016-08-24 12:15:38 -070061struct nd_cmd_ars_start {
Christopher Ferris05d08e92016-02-04 13:16:38 -080062 __u64 address;
63 __u64 length;
64 __u16 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -070065 __u8 flags;
66 __u8 reserved[5];
Christopher Ferris05d08e92016-02-04 13:16:38 -080067 __u32 status;
Christopher Ferris106b3a82016-08-24 12:15:38 -070068 __u32 scrub_time;
Christopher Ferris05d08e92016-02-04 13:16:38 -080069} __packed;
70struct nd_cmd_ars_status {
71 __u32 status;
Christopher Ferris05d08e92016-02-04 13:16:38 -080072 __u32 out_length;
73 __u64 address;
74 __u64 length;
Christopher Ferris106b3a82016-08-24 12:15:38 -070075 __u64 restart_address;
76 __u64 restart_length;
Christopher Ferris106b3a82016-08-24 12:15:38 -070077 __u16 type;
78 __u16 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -080079 __u32 num_records;
80 struct nd_ars_record {
Christopher Ferris106b3a82016-08-24 12:15:38 -070081 __u32 handle;
82 __u32 reserved;
Christopher Ferris05d08e92016-02-04 13:16:38 -080083 __u64 err_address;
84 __u64 length;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070085 } __packed records[];
Christopher Ferris05d08e92016-02-04 13:16:38 -080086} __packed;
Christopher Ferris106b3a82016-08-24 12:15:38 -070087struct nd_cmd_clear_error {
88 __u64 address;
Christopher Ferris106b3a82016-08-24 12:15:38 -070089 __u64 length;
90 __u32 status;
91 __u8 reserved[4];
92 __u64 cleared;
Christopher Ferris106b3a82016-08-24 12:15:38 -070093} __packed;
Christopher Ferris05d08e92016-02-04 13:16:38 -080094enum {
95 ND_CMD_IMPLEMENTED = 0,
96 ND_CMD_ARS_CAP = 1,
Christopher Ferris106b3a82016-08-24 12:15:38 -070097 ND_CMD_ARS_START = 2,
Christopher Ferris05d08e92016-02-04 13:16:38 -080098 ND_CMD_ARS_STATUS = 3,
Christopher Ferris106b3a82016-08-24 12:15:38 -070099 ND_CMD_CLEAR_ERROR = 4,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800100 ND_CMD_SMART = 1,
101 ND_CMD_SMART_THRESHOLD = 2,
102 ND_CMD_DIMM_FLAGS = 3,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800103 ND_CMD_GET_CONFIG_SIZE = 4,
104 ND_CMD_GET_CONFIG_DATA = 5,
105 ND_CMD_SET_CONFIG_DATA = 6,
106 ND_CMD_VENDOR_EFFECT_LOG_SIZE = 7,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107 ND_CMD_VENDOR_EFFECT_LOG = 8,
108 ND_CMD_VENDOR = 9,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700109 ND_CMD_CALL = 10,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110};
111enum {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800112 ND_ARS_VOLATILE = 1,
113 ND_ARS_PERSISTENT = 2,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800114 ND_ARS_RETURN_PREV_DATA = 1 << 1,
Christopher Ferris525ce912017-07-26 13:12:53 -0700115 ND_CONFIG_LOCKED = 1,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800116};
117#define ND_IOCTL 'N'
Christopher Ferris05d08e92016-02-04 13:16:38 -0800118#define ND_IOCTL_DIMM_FLAGS _IOWR(ND_IOCTL, ND_CMD_DIMM_FLAGS, struct nd_cmd_dimm_flags)
119#define ND_IOCTL_GET_CONFIG_SIZE _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_SIZE, struct nd_cmd_get_config_size)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800120#define ND_IOCTL_GET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_DATA, struct nd_cmd_get_config_data_hdr)
121#define ND_IOCTL_SET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_SET_CONFIG_DATA, struct nd_cmd_set_config_hdr)
122#define ND_IOCTL_VENDOR _IOWR(ND_IOCTL, ND_CMD_VENDOR, struct nd_cmd_vendor_hdr)
123#define ND_IOCTL_ARS_CAP _IOWR(ND_IOCTL, ND_CMD_ARS_CAP, struct nd_cmd_ars_cap)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800124#define ND_IOCTL_ARS_START _IOWR(ND_IOCTL, ND_CMD_ARS_START, struct nd_cmd_ars_start)
125#define ND_IOCTL_ARS_STATUS _IOWR(ND_IOCTL, ND_CMD_ARS_STATUS, struct nd_cmd_ars_status)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700126#define ND_IOCTL_CLEAR_ERROR _IOWR(ND_IOCTL, ND_CMD_CLEAR_ERROR, struct nd_cmd_clear_error)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800127#define ND_DEVICE_DIMM 1
128#define ND_DEVICE_REGION_PMEM 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800129#define ND_DEVICE_REGION_BLK 3
130#define ND_DEVICE_NAMESPACE_IO 4
131#define ND_DEVICE_NAMESPACE_PMEM 5
Christopher Ferris106b3a82016-08-24 12:15:38 -0700132#define ND_DEVICE_DAX_PMEM 7
Christopher Ferris05d08e92016-02-04 13:16:38 -0800133enum nd_driver_flags {
134 ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM,
135 ND_DRIVER_REGION_PMEM = 1 << ND_DEVICE_REGION_PMEM,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700136 ND_DRIVER_REGION_BLK = 1 << ND_DEVICE_REGION_BLK,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800137 ND_DRIVER_NAMESPACE_IO = 1 << ND_DEVICE_NAMESPACE_IO,
138 ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700139 ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM,
140};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800141enum ars_masks {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800142 ARS_STATUS_MASK = 0x0000FFFF,
143 ARS_EXT_STATUS_SHIFT = 16,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700144};
145struct nd_cmd_pkg {
146 __u64 nd_family;
147 __u64 nd_command;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700148 __u32 nd_size_in;
149 __u32 nd_size_out;
150 __u32 nd_reserved2[9];
151 __u32 nd_fw_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700152 unsigned char nd_payload[];
153};
154#define NVDIMM_FAMILY_INTEL 0
155#define NVDIMM_FAMILY_HPE1 1
Christopher Ferris106b3a82016-08-24 12:15:38 -0700156#define NVDIMM_FAMILY_HPE2 2
Christopher Ferris49f525c2016-12-12 14:55:36 -0800157#define NVDIMM_FAMILY_MSFT 3
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700158#define NVDIMM_FAMILY_HYPERV 4
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700159#define NVDIMM_FAMILY_PAPR 5
Christopher Ferris25c18d42020-10-14 17:42:58 -0700160#define NVDIMM_FAMILY_MAX NVDIMM_FAMILY_PAPR
161#define NVDIMM_BUS_FAMILY_NFIT 0
162#define NVDIMM_BUS_FAMILY_INTEL 1
163#define NVDIMM_BUS_FAMILY_MAX NVDIMM_BUS_FAMILY_INTEL
Christopher Ferris106b3a82016-08-24 12:15:38 -0700164#define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL, struct nd_cmd_pkg)
165#endif