| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 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 { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 23 | __u32 status; | 
|  | 24 | __u8 data[128]; | 
|  | 25 | } __packed; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 26 | #define ND_SMART_HEALTH_VALID (1 << 0) | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 27 | #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 Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 31 | #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 Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 35 | #define ND_SMART_TEMP_TRIP (1 << 1) | 
|  | 36 | #define ND_SMART_CTEMP_TRIP (1 << 2) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 37 | #define ND_SMART_NON_CRITICAL_HEALTH (1 << 0) | 
|  | 38 | #define ND_SMART_CRITICAL_HEALTH (1 << 1) | 
|  | 39 | #define ND_SMART_FATAL_HEALTH (1 << 2) | 
|  | 40 | struct nd_smart_payload { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 41 | __u32 flags; | 
|  | 42 | __u8 reserved0[4]; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 43 | __u8 health; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 44 | __u8 spares; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 45 | __u8 life_used; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 46 | __u8 alarm_flags; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 47 | __u16 temperature; | 
|  | 48 | __u16 ctrl_temperature; | 
|  | 49 | __u8 reserved1[15]; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 50 | __u8 shutdown_state; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 51 | __u32 vendor_size; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 52 | __u8 vendor_data[92]; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 53 | } __packed; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 54 | struct nd_cmd_smart_threshold { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 55 | __u32 status; | 
|  | 56 | __u8 data[8]; | 
|  | 57 | } __packed; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 58 | struct nd_smart_threshold_payload { | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 59 | __u8 alarm_control; | 
|  | 60 | __u8 reserved0; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 61 | __u16 temperature; | 
|  | 62 | __u8 spares; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 63 | __u8 reserved[3]; | 
|  | 64 | } __packed; | 
|  | 65 | struct nd_cmd_dimm_flags { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 66 | __u32 status; | 
|  | 67 | __u32 flags; | 
|  | 68 | } __packed; | 
|  | 69 | struct nd_cmd_get_config_size { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 70 | __u32 status; | 
|  | 71 | __u32 config_size; | 
|  | 72 | __u32 max_xfer; | 
|  | 73 | } __packed; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 74 | struct nd_cmd_get_config_data_hdr { | 
|  | 75 | __u32 in_offset; | 
|  | 76 | __u32 in_length; | 
|  | 77 | __u32 status; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 78 | __u8 out_buf[0]; | 
|  | 79 | } __packed; | 
|  | 80 | struct nd_cmd_set_config_hdr { | 
|  | 81 | __u32 in_offset; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 82 | __u32 in_length; | 
|  | 83 | __u8 in_buf[0]; | 
|  | 84 | } __packed; | 
|  | 85 | struct nd_cmd_vendor_hdr { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 86 | __u32 opcode; | 
|  | 87 | __u32 in_length; | 
|  | 88 | __u8 in_buf[0]; | 
|  | 89 | } __packed; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 90 | struct nd_cmd_vendor_tail { | 
|  | 91 | __u32 status; | 
|  | 92 | __u32 out_length; | 
|  | 93 | __u8 out_buf[0]; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 94 | } __packed; | 
|  | 95 | struct nd_cmd_ars_cap { | 
|  | 96 | __u64 address; | 
|  | 97 | __u64 length; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 98 | __u32 status; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 99 | __u32 max_ars_out; | 
|  | 100 | __u32 clear_err_unit; | 
|  | 101 | __u32 reserved; | 
|  | 102 | } __packed; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 103 | struct nd_cmd_ars_start { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 104 | __u64 address; | 
|  | 105 | __u64 length; | 
|  | 106 | __u16 type; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 107 | __u8 flags; | 
|  | 108 | __u8 reserved[5]; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 109 | __u32 status; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 110 | __u32 scrub_time; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 111 | } __packed; | 
|  | 112 | struct nd_cmd_ars_status { | 
|  | 113 | __u32 status; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 114 | __u32 out_length; | 
|  | 115 | __u64 address; | 
|  | 116 | __u64 length; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 117 | __u64 restart_address; | 
|  | 118 | __u64 restart_length; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 119 | __u16 type; | 
|  | 120 | __u16 flags; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 121 | __u32 num_records; | 
|  | 122 | struct nd_ars_record { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 123 | __u32 handle; | 
|  | 124 | __u32 reserved; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 125 | __u64 err_address; | 
|  | 126 | __u64 length; | 
|  | 127 | } __packed records[0]; | 
|  | 128 | } __packed; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 129 | struct nd_cmd_clear_error { | 
|  | 130 | __u64 address; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 131 | __u64 length; | 
|  | 132 | __u32 status; | 
|  | 133 | __u8 reserved[4]; | 
|  | 134 | __u64 cleared; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 135 | } __packed; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 136 | enum { | 
|  | 137 | ND_CMD_IMPLEMENTED = 0, | 
|  | 138 | ND_CMD_ARS_CAP = 1, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 139 | ND_CMD_ARS_START = 2, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 140 | ND_CMD_ARS_STATUS = 3, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 141 | ND_CMD_CLEAR_ERROR = 4, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 142 | ND_CMD_SMART = 1, | 
|  | 143 | ND_CMD_SMART_THRESHOLD = 2, | 
|  | 144 | ND_CMD_DIMM_FLAGS = 3, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 145 | ND_CMD_GET_CONFIG_SIZE = 4, | 
|  | 146 | ND_CMD_GET_CONFIG_DATA = 5, | 
|  | 147 | ND_CMD_SET_CONFIG_DATA = 6, | 
|  | 148 | ND_CMD_VENDOR_EFFECT_LOG_SIZE = 7, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 149 | ND_CMD_VENDOR_EFFECT_LOG = 8, | 
|  | 150 | ND_CMD_VENDOR = 9, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 151 | ND_CMD_CALL = 10, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 152 | }; | 
|  | 153 | enum { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 154 | ND_ARS_VOLATILE = 1, | 
|  | 155 | ND_ARS_PERSISTENT = 2, | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 156 | ND_CONFIG_LOCKED = 1, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 157 | }; | 
|  | 158 | #define ND_IOCTL 'N' | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 159 | #define ND_IOCTL_SMART _IOWR(ND_IOCTL, ND_CMD_SMART, struct nd_cmd_smart) | 
|  | 160 | #define ND_IOCTL_SMART_THRESHOLD _IOWR(ND_IOCTL, ND_CMD_SMART_THRESHOLD, struct nd_cmd_smart_threshold) | 
|  | 161 | #define ND_IOCTL_DIMM_FLAGS _IOWR(ND_IOCTL, ND_CMD_DIMM_FLAGS, struct nd_cmd_dimm_flags) | 
|  | 162 | #define ND_IOCTL_GET_CONFIG_SIZE _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_SIZE, struct nd_cmd_get_config_size) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 163 | #define ND_IOCTL_GET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_DATA, struct nd_cmd_get_config_data_hdr) | 
|  | 164 | #define ND_IOCTL_SET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_SET_CONFIG_DATA, struct nd_cmd_set_config_hdr) | 
|  | 165 | #define ND_IOCTL_VENDOR _IOWR(ND_IOCTL, ND_CMD_VENDOR, struct nd_cmd_vendor_hdr) | 
|  | 166 | #define ND_IOCTL_ARS_CAP _IOWR(ND_IOCTL, ND_CMD_ARS_CAP, struct nd_cmd_ars_cap) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 167 | #define ND_IOCTL_ARS_START _IOWR(ND_IOCTL, ND_CMD_ARS_START, struct nd_cmd_ars_start) | 
|  | 168 | #define ND_IOCTL_ARS_STATUS _IOWR(ND_IOCTL, ND_CMD_ARS_STATUS, struct nd_cmd_ars_status) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 169 | #define ND_IOCTL_CLEAR_ERROR _IOWR(ND_IOCTL, ND_CMD_CLEAR_ERROR, struct nd_cmd_clear_error) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 170 | #define ND_DEVICE_DIMM 1 | 
|  | 171 | #define ND_DEVICE_REGION_PMEM 2 | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 172 | #define ND_DEVICE_REGION_BLK 3 | 
|  | 173 | #define ND_DEVICE_NAMESPACE_IO 4 | 
|  | 174 | #define ND_DEVICE_NAMESPACE_PMEM 5 | 
|  | 175 | #define ND_DEVICE_NAMESPACE_BLK 6 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 176 | #define ND_DEVICE_DAX_PMEM 7 | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 177 | enum nd_driver_flags { | 
|  | 178 | ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM, | 
|  | 179 | ND_DRIVER_REGION_PMEM = 1 << ND_DEVICE_REGION_PMEM, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 180 | ND_DRIVER_REGION_BLK = 1 << ND_DEVICE_REGION_BLK, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 181 | ND_DRIVER_NAMESPACE_IO = 1 << ND_DEVICE_NAMESPACE_IO, | 
|  | 182 | ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM, | 
|  | 183 | ND_DRIVER_NAMESPACE_BLK = 1 << ND_DEVICE_NAMESPACE_BLK, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 184 | ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM, | 
|  | 185 | }; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 186 | enum { | 
|  | 187 | ND_MIN_NAMESPACE_SIZE = 0x00400000, | 
|  | 188 | }; | 
|  | 189 | enum ars_masks { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 190 | ARS_STATUS_MASK = 0x0000FFFF, | 
|  | 191 | ARS_EXT_STATUS_SHIFT = 16, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 192 | }; | 
|  | 193 | struct nd_cmd_pkg { | 
|  | 194 | __u64 nd_family; | 
|  | 195 | __u64 nd_command; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 196 | __u32 nd_size_in; | 
|  | 197 | __u32 nd_size_out; | 
|  | 198 | __u32 nd_reserved2[9]; | 
|  | 199 | __u32 nd_fw_size; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 200 | unsigned char nd_payload[]; | 
|  | 201 | }; | 
|  | 202 | #define NVDIMM_FAMILY_INTEL 0 | 
|  | 203 | #define NVDIMM_FAMILY_HPE1 1 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 204 | #define NVDIMM_FAMILY_HPE2 2 | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 205 | #define NVDIMM_FAMILY_MSFT 3 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 206 | #define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL, struct nd_cmd_pkg) | 
|  | 207 | #endif |