blob: 44c9ee079444d63dd91c83c30200aef57438d8ba [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>
22struct nd_cmd_smart {
Christopher Ferris05d08e92016-02-04 13:16:38 -080023 __u32 status;
24 __u8 data[128];
25} __packed;
Christopher Ferris106b3a82016-08-24 12:15:38 -070026#define ND_SMART_HEALTH_VALID (1 << 0)
Christopher Ferris6a9755d2017-01-13 14:09:31 -080027#define ND_SMART_SPARES_VALID (1 << 1)
28#define ND_SMART_USED_VALID (1 << 2)
29#define ND_SMART_TEMP_VALID (1 << 3)
30#define ND_SMART_CTEMP_VALID (1 << 4)
Christopher Ferris6a9755d2017-01-13 14:09:31 -080031#define ND_SMART_ALARM_VALID (1 << 9)
32#define ND_SMART_SHUTDOWN_VALID (1 << 10)
33#define ND_SMART_VENDOR_VALID (1 << 11)
34#define ND_SMART_SPARE_TRIP (1 << 0)
Christopher Ferris6a9755d2017-01-13 14:09:31 -080035#define ND_SMART_TEMP_TRIP (1 << 1)
36#define ND_SMART_CTEMP_TRIP (1 << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -070037#define ND_SMART_NON_CRITICAL_HEALTH (1 << 0)
38#define ND_SMART_CRITICAL_HEALTH (1 << 1)
39#define ND_SMART_FATAL_HEALTH (1 << 2)
40struct nd_smart_payload {
Christopher Ferris106b3a82016-08-24 12:15:38 -070041 __u32 flags;
42 __u8 reserved0[4];
Christopher Ferris6a9755d2017-01-13 14:09:31 -080043 __u8 health;
Christopher Ferris106b3a82016-08-24 12:15:38 -070044 __u8 spares;
Christopher Ferris106b3a82016-08-24 12:15:38 -070045 __u8 life_used;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080046 __u8 alarm_flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080047 __u16 temperature;
48 __u16 ctrl_temperature;
49 __u8 reserved1[15];
Christopher Ferris106b3a82016-08-24 12:15:38 -070050 __u8 shutdown_state;
Christopher Ferris106b3a82016-08-24 12:15:38 -070051 __u32 vendor_size;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080052 __u8 vendor_data[92];
Christopher Ferris106b3a82016-08-24 12:15:38 -070053} __packed;
Christopher Ferris106b3a82016-08-24 12:15:38 -070054struct nd_cmd_smart_threshold {
Christopher Ferris05d08e92016-02-04 13:16:38 -080055 __u32 status;
56 __u8 data[8];
57} __packed;
Christopher Ferris106b3a82016-08-24 12:15:38 -070058struct nd_smart_threshold_payload {
Christopher Ferris6a9755d2017-01-13 14:09:31 -080059 __u8 alarm_control;
60 __u8 reserved0;
Christopher Ferris106b3a82016-08-24 12:15:38 -070061 __u16 temperature;
62 __u8 spares;
Christopher Ferris106b3a82016-08-24 12:15:38 -070063 __u8 reserved[3];
64} __packed;
65struct nd_cmd_dimm_flags {
Christopher Ferris05d08e92016-02-04 13:16:38 -080066 __u32 status;
67 __u32 flags;
68} __packed;
69struct nd_cmd_get_config_size {
Christopher Ferris05d08e92016-02-04 13:16:38 -080070 __u32 status;
71 __u32 config_size;
72 __u32 max_xfer;
73} __packed;
Christopher Ferris05d08e92016-02-04 13:16:38 -080074struct nd_cmd_get_config_data_hdr {
75 __u32 in_offset;
76 __u32 in_length;
77 __u32 status;
Christopher Ferris05d08e92016-02-04 13:16:38 -080078 __u8 out_buf[0];
79} __packed;
80struct nd_cmd_set_config_hdr {
81 __u32 in_offset;
Christopher Ferris05d08e92016-02-04 13:16:38 -080082 __u32 in_length;
83 __u8 in_buf[0];
84} __packed;
85struct nd_cmd_vendor_hdr {
Christopher Ferris05d08e92016-02-04 13:16:38 -080086 __u32 opcode;
87 __u32 in_length;
88 __u8 in_buf[0];
89} __packed;
Christopher Ferris05d08e92016-02-04 13:16:38 -080090struct nd_cmd_vendor_tail {
91 __u32 status;
92 __u32 out_length;
93 __u8 out_buf[0];
Christopher Ferris05d08e92016-02-04 13:16:38 -080094} __packed;
95struct nd_cmd_ars_cap {
96 __u64 address;
97 __u64 length;
Christopher Ferris05d08e92016-02-04 13:16:38 -080098 __u32 status;
Christopher Ferris106b3a82016-08-24 12:15:38 -070099 __u32 max_ars_out;
100 __u32 clear_err_unit;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800101 __u16 flags;
102 __u16 reserved;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700103} __packed;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700104struct nd_cmd_ars_start {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800105 __u64 address;
106 __u64 length;
107 __u16 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700108 __u8 flags;
109 __u8 reserved[5];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110 __u32 status;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700111 __u32 scrub_time;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800112} __packed;
113struct nd_cmd_ars_status {
114 __u32 status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800115 __u32 out_length;
116 __u64 address;
117 __u64 length;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700118 __u64 restart_address;
119 __u64 restart_length;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700120 __u16 type;
121 __u16 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800122 __u32 num_records;
123 struct nd_ars_record {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700124 __u32 handle;
125 __u32 reserved;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800126 __u64 err_address;
127 __u64 length;
128 } __packed records[0];
129} __packed;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700130struct nd_cmd_clear_error {
131 __u64 address;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700132 __u64 length;
133 __u32 status;
134 __u8 reserved[4];
135 __u64 cleared;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700136} __packed;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800137enum {
138 ND_CMD_IMPLEMENTED = 0,
139 ND_CMD_ARS_CAP = 1,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700140 ND_CMD_ARS_START = 2,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800141 ND_CMD_ARS_STATUS = 3,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700142 ND_CMD_CLEAR_ERROR = 4,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800143 ND_CMD_SMART = 1,
144 ND_CMD_SMART_THRESHOLD = 2,
145 ND_CMD_DIMM_FLAGS = 3,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800146 ND_CMD_GET_CONFIG_SIZE = 4,
147 ND_CMD_GET_CONFIG_DATA = 5,
148 ND_CMD_SET_CONFIG_DATA = 6,
149 ND_CMD_VENDOR_EFFECT_LOG_SIZE = 7,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800150 ND_CMD_VENDOR_EFFECT_LOG = 8,
151 ND_CMD_VENDOR = 9,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700152 ND_CMD_CALL = 10,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800153};
154enum {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800155 ND_ARS_VOLATILE = 1,
156 ND_ARS_PERSISTENT = 2,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800157 ND_ARS_RETURN_PREV_DATA = 1 << 1,
Christopher Ferris525ce912017-07-26 13:12:53 -0700158 ND_CONFIG_LOCKED = 1,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800159};
160#define ND_IOCTL 'N'
Christopher Ferris05d08e92016-02-04 13:16:38 -0800161#define ND_IOCTL_SMART _IOWR(ND_IOCTL, ND_CMD_SMART, struct nd_cmd_smart)
162#define ND_IOCTL_SMART_THRESHOLD _IOWR(ND_IOCTL, ND_CMD_SMART_THRESHOLD, struct nd_cmd_smart_threshold)
163#define ND_IOCTL_DIMM_FLAGS _IOWR(ND_IOCTL, ND_CMD_DIMM_FLAGS, struct nd_cmd_dimm_flags)
164#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 -0800165#define ND_IOCTL_GET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_DATA, struct nd_cmd_get_config_data_hdr)
166#define ND_IOCTL_SET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_SET_CONFIG_DATA, struct nd_cmd_set_config_hdr)
167#define ND_IOCTL_VENDOR _IOWR(ND_IOCTL, ND_CMD_VENDOR, struct nd_cmd_vendor_hdr)
168#define ND_IOCTL_ARS_CAP _IOWR(ND_IOCTL, ND_CMD_ARS_CAP, struct nd_cmd_ars_cap)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800169#define ND_IOCTL_ARS_START _IOWR(ND_IOCTL, ND_CMD_ARS_START, struct nd_cmd_ars_start)
170#define ND_IOCTL_ARS_STATUS _IOWR(ND_IOCTL, ND_CMD_ARS_STATUS, struct nd_cmd_ars_status)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700171#define ND_IOCTL_CLEAR_ERROR _IOWR(ND_IOCTL, ND_CMD_CLEAR_ERROR, struct nd_cmd_clear_error)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800172#define ND_DEVICE_DIMM 1
173#define ND_DEVICE_REGION_PMEM 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800174#define ND_DEVICE_REGION_BLK 3
175#define ND_DEVICE_NAMESPACE_IO 4
176#define ND_DEVICE_NAMESPACE_PMEM 5
177#define ND_DEVICE_NAMESPACE_BLK 6
Christopher Ferris106b3a82016-08-24 12:15:38 -0700178#define ND_DEVICE_DAX_PMEM 7
Christopher Ferris05d08e92016-02-04 13:16:38 -0800179enum nd_driver_flags {
180 ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM,
181 ND_DRIVER_REGION_PMEM = 1 << ND_DEVICE_REGION_PMEM,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700182 ND_DRIVER_REGION_BLK = 1 << ND_DEVICE_REGION_BLK,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800183 ND_DRIVER_NAMESPACE_IO = 1 << ND_DEVICE_NAMESPACE_IO,
184 ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM,
185 ND_DRIVER_NAMESPACE_BLK = 1 << ND_DEVICE_NAMESPACE_BLK,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700186 ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM,
187};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800188enum {
189 ND_MIN_NAMESPACE_SIZE = 0x00400000,
190};
191enum ars_masks {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800192 ARS_STATUS_MASK = 0x0000FFFF,
193 ARS_EXT_STATUS_SHIFT = 16,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700194};
195struct nd_cmd_pkg {
196 __u64 nd_family;
197 __u64 nd_command;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700198 __u32 nd_size_in;
199 __u32 nd_size_out;
200 __u32 nd_reserved2[9];
201 __u32 nd_fw_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700202 unsigned char nd_payload[];
203};
204#define NVDIMM_FAMILY_INTEL 0
205#define NVDIMM_FAMILY_HPE1 1
Christopher Ferris106b3a82016-08-24 12:15:38 -0700206#define NVDIMM_FAMILY_HPE2 2
Christopher Ferris49f525c2016-12-12 14:55:36 -0800207#define NVDIMM_FAMILY_MSFT 3
Christopher Ferris106b3a82016-08-24 12:15:38 -0700208#define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL, struct nd_cmd_pkg)
209#endif