| 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> | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 22 | struct nd_cmd_dimm_flags { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 23 | __u32 status; | 
|  | 24 | __u32 flags; | 
|  | 25 | } __packed; | 
|  | 26 | struct nd_cmd_get_config_size { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 27 | __u32 status; | 
|  | 28 | __u32 config_size; | 
|  | 29 | __u32 max_xfer; | 
|  | 30 | } __packed; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 31 | struct nd_cmd_get_config_data_hdr { | 
|  | 32 | __u32 in_offset; | 
|  | 33 | __u32 in_length; | 
|  | 34 | __u32 status; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 35 | __u8 out_buf[0]; | 
|  | 36 | } __packed; | 
|  | 37 | struct nd_cmd_set_config_hdr { | 
|  | 38 | __u32 in_offset; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 39 | __u32 in_length; | 
|  | 40 | __u8 in_buf[0]; | 
|  | 41 | } __packed; | 
|  | 42 | struct nd_cmd_vendor_hdr { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 43 | __u32 opcode; | 
|  | 44 | __u32 in_length; | 
|  | 45 | __u8 in_buf[0]; | 
|  | 46 | } __packed; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 47 | struct nd_cmd_vendor_tail { | 
|  | 48 | __u32 status; | 
|  | 49 | __u32 out_length; | 
|  | 50 | __u8 out_buf[0]; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 51 | } __packed; | 
|  | 52 | struct nd_cmd_ars_cap { | 
|  | 53 | __u64 address; | 
|  | 54 | __u64 length; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 55 | __u32 status; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 56 | __u32 max_ars_out; | 
|  | 57 | __u32 clear_err_unit; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 58 | __u16 flags; | 
|  | 59 | __u16 reserved; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 60 | } __packed; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 61 | struct nd_cmd_ars_start { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 62 | __u64 address; | 
|  | 63 | __u64 length; | 
|  | 64 | __u16 type; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 65 | __u8 flags; | 
|  | 66 | __u8 reserved[5]; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 67 | __u32 status; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 68 | __u32 scrub_time; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 69 | } __packed; | 
|  | 70 | struct nd_cmd_ars_status { | 
|  | 71 | __u32 status; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 72 | __u32 out_length; | 
|  | 73 | __u64 address; | 
|  | 74 | __u64 length; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 75 | __u64 restart_address; | 
|  | 76 | __u64 restart_length; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 77 | __u16 type; | 
|  | 78 | __u16 flags; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 79 | __u32 num_records; | 
|  | 80 | struct nd_ars_record { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 81 | __u32 handle; | 
|  | 82 | __u32 reserved; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 83 | __u64 err_address; | 
|  | 84 | __u64 length; | 
|  | 85 | } __packed records[0]; | 
|  | 86 | } __packed; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 87 | struct nd_cmd_clear_error { | 
|  | 88 | __u64 address; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 89 | __u64 length; | 
|  | 90 | __u32 status; | 
|  | 91 | __u8 reserved[4]; | 
|  | 92 | __u64 cleared; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 93 | } __packed; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 94 | enum { | 
|  | 95 | ND_CMD_IMPLEMENTED = 0, | 
|  | 96 | ND_CMD_ARS_CAP = 1, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 97 | ND_CMD_ARS_START = 2, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 98 | ND_CMD_ARS_STATUS = 3, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 99 | ND_CMD_CLEAR_ERROR = 4, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 100 | ND_CMD_SMART = 1, | 
|  | 101 | ND_CMD_SMART_THRESHOLD = 2, | 
|  | 102 | ND_CMD_DIMM_FLAGS = 3, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 103 | 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 Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 107 | ND_CMD_VENDOR_EFFECT_LOG = 8, | 
|  | 108 | ND_CMD_VENDOR = 9, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 109 | ND_CMD_CALL = 10, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 110 | }; | 
|  | 111 | enum { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 112 | ND_ARS_VOLATILE = 1, | 
|  | 113 | ND_ARS_PERSISTENT = 2, | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 114 | ND_ARS_RETURN_PREV_DATA = 1 << 1, | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 115 | ND_CONFIG_LOCKED = 1, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 116 | }; | 
|  | 117 | #define ND_IOCTL 'N' | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 118 | #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 Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 120 | #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 Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 124 | #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 Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 126 | #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] | 127 | #define ND_DEVICE_DIMM 1 | 
|  | 128 | #define ND_DEVICE_REGION_PMEM 2 | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 129 | #define ND_DEVICE_REGION_BLK 3 | 
|  | 130 | #define ND_DEVICE_NAMESPACE_IO 4 | 
|  | 131 | #define ND_DEVICE_NAMESPACE_PMEM 5 | 
|  | 132 | #define ND_DEVICE_NAMESPACE_BLK 6 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 133 | #define ND_DEVICE_DAX_PMEM 7 | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 134 | enum nd_driver_flags { | 
|  | 135 | ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM, | 
|  | 136 | ND_DRIVER_REGION_PMEM = 1 << ND_DEVICE_REGION_PMEM, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 137 | ND_DRIVER_REGION_BLK = 1 << ND_DEVICE_REGION_BLK, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 138 | ND_DRIVER_NAMESPACE_IO = 1 << ND_DEVICE_NAMESPACE_IO, | 
|  | 139 | ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM, | 
|  | 140 | ND_DRIVER_NAMESPACE_BLK = 1 << ND_DEVICE_NAMESPACE_BLK, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 141 | ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM, | 
|  | 142 | }; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 143 | enum ars_masks { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 144 | ARS_STATUS_MASK = 0x0000FFFF, | 
|  | 145 | ARS_EXT_STATUS_SHIFT = 16, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 146 | }; | 
|  | 147 | struct nd_cmd_pkg { | 
|  | 148 | __u64 nd_family; | 
|  | 149 | __u64 nd_command; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 150 | __u32 nd_size_in; | 
|  | 151 | __u32 nd_size_out; | 
|  | 152 | __u32 nd_reserved2[9]; | 
|  | 153 | __u32 nd_fw_size; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 154 | unsigned char nd_payload[]; | 
|  | 155 | }; | 
|  | 156 | #define NVDIMM_FAMILY_INTEL 0 | 
|  | 157 | #define NVDIMM_FAMILY_HPE1 1 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 158 | #define NVDIMM_FAMILY_HPE2 2 | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 159 | #define NVDIMM_FAMILY_MSFT 3 | 
| Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 160 | #define NVDIMM_FAMILY_HYPERV 4 | 
| Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 161 | #define NVDIMM_FAMILY_PAPR 5 | 
| Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 162 | #define NVDIMM_FAMILY_MAX NVDIMM_FAMILY_PAPR | 
|  | 163 | #define NVDIMM_BUS_FAMILY_NFIT 0 | 
|  | 164 | #define NVDIMM_BUS_FAMILY_INTEL 1 | 
|  | 165 | #define NVDIMM_BUS_FAMILY_MAX NVDIMM_BUS_FAMILY_INTEL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 166 | #define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL, struct nd_cmd_pkg) | 
|  | 167 | #endif |