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