1 /****************************************************************************
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>
22 struct nd_cmd_smart {
23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24   __u32 status;
25   __u8 data[128];
26 } __packed;
27 #define ND_SMART_HEALTH_VALID (1 << 0)
28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29 #define ND_SMART_SPARES_VALID (1 << 1)
30 #define ND_SMART_USED_VALID (1 << 2)
31 #define ND_SMART_TEMP_VALID (1 << 3)
32 #define ND_SMART_CTEMP_VALID (1 << 4)
33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34 #define ND_SMART_ALARM_VALID (1 << 9)
35 #define ND_SMART_SHUTDOWN_VALID (1 << 10)
36 #define ND_SMART_VENDOR_VALID (1 << 11)
37 #define ND_SMART_SPARE_TRIP (1 << 0)
38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39 #define ND_SMART_TEMP_TRIP (1 << 1)
40 #define ND_SMART_CTEMP_TRIP (1 << 2)
41 #define ND_SMART_NON_CRITICAL_HEALTH (1 << 0)
42 #define ND_SMART_CRITICAL_HEALTH (1 << 1)
43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44 #define ND_SMART_FATAL_HEALTH (1 << 2)
45 struct nd_smart_payload {
46   __u32 flags;
47   __u8 reserved0[4];
48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49   __u8 health;
50   __u8 spares;
51   __u8 life_used;
52   __u8 alarm_flags;
53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54   __u16 temperature;
55   __u16 ctrl_temperature;
56   __u8 reserved1[15];
57   __u8 shutdown_state;
58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59   __u32 vendor_size;
60   __u8 vendor_data[92];
61 } __packed;
62 struct nd_cmd_smart_threshold {
63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64   __u32 status;
65   __u8 data[8];
66 } __packed;
67 struct nd_smart_threshold_payload {
68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69   __u8 alarm_control;
70   __u8 reserved0;
71   __u16 temperature;
72   __u8 spares;
73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74   __u8 reserved[3];
75 } __packed;
76 struct nd_cmd_dimm_flags {
77   __u32 status;
78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79   __u32 flags;
80 } __packed;
81 struct nd_cmd_get_config_size {
82   __u32 status;
83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84   __u32 config_size;
85   __u32 max_xfer;
86 } __packed;
87 struct nd_cmd_get_config_data_hdr {
88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89   __u32 in_offset;
90   __u32 in_length;
91   __u32 status;
92   __u8 out_buf[0];
93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94 } __packed;
95 struct nd_cmd_set_config_hdr {
96   __u32 in_offset;
97   __u32 in_length;
98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99   __u8 in_buf[0];
100 } __packed;
101 struct nd_cmd_vendor_hdr {
102   __u32 opcode;
103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104   __u32 in_length;
105   __u8 in_buf[0];
106 } __packed;
107 struct nd_cmd_vendor_tail {
108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109   __u32 status;
110   __u32 out_length;
111   __u8 out_buf[0];
112 } __packed;
113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114 struct nd_cmd_ars_cap {
115   __u64 address;
116   __u64 length;
117   __u32 status;
118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119   __u32 max_ars_out;
120   __u32 clear_err_unit;
121   __u32 reserved;
122 } __packed;
123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124 struct nd_cmd_ars_start {
125   __u64 address;
126   __u64 length;
127   __u16 type;
128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129   __u8 flags;
130   __u8 reserved[5];
131   __u32 status;
132   __u32 scrub_time;
133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134 } __packed;
135 struct nd_cmd_ars_status {
136   __u32 status;
137   __u32 out_length;
138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139   __u64 address;
140   __u64 length;
141   __u64 restart_address;
142   __u64 restart_length;
143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144   __u16 type;
145   __u16 flags;
146   __u32 num_records;
147   struct nd_ars_record {
148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149     __u32 handle;
150     __u32 reserved;
151     __u64 err_address;
152     __u64 length;
153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154   } __packed records[0];
155 } __packed;
156 struct nd_cmd_clear_error {
157   __u64 address;
158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159   __u64 length;
160   __u32 status;
161   __u8 reserved[4];
162   __u64 cleared;
163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164 } __packed;
165 enum {
166   ND_CMD_IMPLEMENTED = 0,
167   ND_CMD_ARS_CAP = 1,
168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169   ND_CMD_ARS_START = 2,
170   ND_CMD_ARS_STATUS = 3,
171   ND_CMD_CLEAR_ERROR = 4,
172   ND_CMD_SMART = 1,
173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174   ND_CMD_SMART_THRESHOLD = 2,
175   ND_CMD_DIMM_FLAGS = 3,
176   ND_CMD_GET_CONFIG_SIZE = 4,
177   ND_CMD_GET_CONFIG_DATA = 5,
178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179   ND_CMD_SET_CONFIG_DATA = 6,
180   ND_CMD_VENDOR_EFFECT_LOG_SIZE = 7,
181   ND_CMD_VENDOR_EFFECT_LOG = 8,
182   ND_CMD_VENDOR = 9,
183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184   ND_CMD_CALL = 10,
185 };
186 enum {
187   ND_ARS_VOLATILE = 1,
188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189   ND_ARS_PERSISTENT = 2,
190 };
191 #define ND_IOCTL 'N'
192 #define ND_IOCTL_SMART _IOWR(ND_IOCTL, ND_CMD_SMART, struct nd_cmd_smart)
193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194 #define ND_IOCTL_SMART_THRESHOLD _IOWR(ND_IOCTL, ND_CMD_SMART_THRESHOLD, struct nd_cmd_smart_threshold)
195 #define ND_IOCTL_DIMM_FLAGS _IOWR(ND_IOCTL, ND_CMD_DIMM_FLAGS, struct nd_cmd_dimm_flags)
196 #define ND_IOCTL_GET_CONFIG_SIZE _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_SIZE, struct nd_cmd_get_config_size)
197 #define ND_IOCTL_GET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_DATA, struct nd_cmd_get_config_data_hdr)
198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199 #define ND_IOCTL_SET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_SET_CONFIG_DATA, struct nd_cmd_set_config_hdr)
200 #define ND_IOCTL_VENDOR _IOWR(ND_IOCTL, ND_CMD_VENDOR, struct nd_cmd_vendor_hdr)
201 #define ND_IOCTL_ARS_CAP _IOWR(ND_IOCTL, ND_CMD_ARS_CAP, struct nd_cmd_ars_cap)
202 #define ND_IOCTL_ARS_START _IOWR(ND_IOCTL, ND_CMD_ARS_START, struct nd_cmd_ars_start)
203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204 #define ND_IOCTL_ARS_STATUS _IOWR(ND_IOCTL, ND_CMD_ARS_STATUS, struct nd_cmd_ars_status)
205 #define ND_IOCTL_CLEAR_ERROR _IOWR(ND_IOCTL, ND_CMD_CLEAR_ERROR, struct nd_cmd_clear_error)
206 #define ND_DEVICE_DIMM 1
207 #define ND_DEVICE_REGION_PMEM 2
208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209 #define ND_DEVICE_REGION_BLK 3
210 #define ND_DEVICE_NAMESPACE_IO 4
211 #define ND_DEVICE_NAMESPACE_PMEM 5
212 #define ND_DEVICE_NAMESPACE_BLK 6
213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
214 #define ND_DEVICE_DAX_PMEM 7
215 enum nd_driver_flags {
216   ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM,
217   ND_DRIVER_REGION_PMEM = 1 << ND_DEVICE_REGION_PMEM,
218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
219   ND_DRIVER_REGION_BLK = 1 << ND_DEVICE_REGION_BLK,
220   ND_DRIVER_NAMESPACE_IO = 1 << ND_DEVICE_NAMESPACE_IO,
221   ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM,
222   ND_DRIVER_NAMESPACE_BLK = 1 << ND_DEVICE_NAMESPACE_BLK,
223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
224   ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM,
225 };
226 enum {
227   ND_MIN_NAMESPACE_SIZE = 0x00400000,
228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
229 };
230 enum ars_masks {
231   ARS_STATUS_MASK = 0x0000FFFF,
232   ARS_EXT_STATUS_SHIFT = 16,
233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
234 };
235 struct nd_cmd_pkg {
236   __u64 nd_family;
237   __u64 nd_command;
238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
239   __u32 nd_size_in;
240   __u32 nd_size_out;
241   __u32 nd_reserved2[9];
242   __u32 nd_fw_size;
243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
244   unsigned char nd_payload[];
245 };
246 #define NVDIMM_FAMILY_INTEL 0
247 #define NVDIMM_FAMILY_HPE1 1
248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
249 #define NVDIMM_FAMILY_HPE2 2
250 #define NVDIMM_FAMILY_MSFT 3
251 #define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL, struct nd_cmd_pkg)
252 #endif
253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
254