blob: 9781905b689a1b96249a11e3ff2aad2712ca06d7 [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 _CXLFLASH_IOCTL_H
20#define _CXLFLASH_IOCTL_H
21#include <linux/types.h>
Christopher Ferris1308ad32017-11-14 17:32:13 -080022#define CXLFLASH_WWID_LEN 16
Christopher Ferris05d08e92016-02-04 13:16:38 -080023#define DK_CXLFLASH_VERSION_0 0
Christopher Ferris05d08e92016-02-04 13:16:38 -080024struct dk_cxlflash_hdr {
25 __u16 version;
26 __u16 rsvd[3];
27 __u64 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -080028 __u64 return_flags;
29};
Christopher Ferris106b3a82016-08-24 12:15:38 -070030#define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -080031#define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL
Christopher Ferris525ce912017-07-26 13:12:53 -070032#define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -080033#define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070034struct dk_cxlflash_attach {
Christopher Ferris05d08e92016-02-04 13:16:38 -080035 struct dk_cxlflash_hdr hdr;
36 __u64 num_interrupts;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080037 __u64 context_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -070038 __u64 mmio_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -080039 __u64 block_size;
40 __u64 adap_fd;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080041 __u64 last_lba;
Christopher Ferris106b3a82016-08-24 12:15:38 -070042 __u64 max_xfer;
Christopher Ferris05d08e92016-02-04 13:16:38 -080043 __u64 reserved[8];
44};
Christopher Ferris6a9755d2017-01-13 14:09:31 -080045struct dk_cxlflash_detach {
Christopher Ferris106b3a82016-08-24 12:15:38 -070046 struct dk_cxlflash_hdr hdr;
Christopher Ferris05d08e92016-02-04 13:16:38 -080047 __u64 context_id;
48 __u64 reserved[8];
Christopher Ferris6a9755d2017-01-13 14:09:31 -080049};
Christopher Ferris106b3a82016-08-24 12:15:38 -070050struct dk_cxlflash_udirect {
Christopher Ferris05d08e92016-02-04 13:16:38 -080051 struct dk_cxlflash_hdr hdr;
52 __u64 context_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080053 __u64 rsrc_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -070054 __u64 last_lba;
Christopher Ferris05d08e92016-02-04 13:16:38 -080055 __u64 reserved[8];
56};
Christopher Ferris6a9755d2017-01-13 14:09:31 -080057#define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070058struct dk_cxlflash_uvirtual {
Christopher Ferris05d08e92016-02-04 13:16:38 -080059 struct dk_cxlflash_hdr hdr;
60 __u64 context_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080061 __u64 lun_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -070062 __u64 rsrc_handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -080063 __u64 last_lba;
64 __u64 reserved[8];
Christopher Ferris6a9755d2017-01-13 14:09:31 -080065};
Christopher Ferris106b3a82016-08-24 12:15:38 -070066struct dk_cxlflash_release {
Christopher Ferris05d08e92016-02-04 13:16:38 -080067 struct dk_cxlflash_hdr hdr;
68 __u64 context_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080069 __u64 rsrc_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -070070 __u64 reserved[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -080071};
72struct dk_cxlflash_resize {
Christopher Ferris6a9755d2017-01-13 14:09:31 -080073 struct dk_cxlflash_hdr hdr;
Christopher Ferris106b3a82016-08-24 12:15:38 -070074 __u64 context_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -080075 __u64 rsrc_handle;
76 __u64 req_size;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080077 __u64 last_lba;
Christopher Ferris106b3a82016-08-24 12:15:38 -070078 __u64 reserved[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -080079};
80struct dk_cxlflash_clone {
Christopher Ferris6a9755d2017-01-13 14:09:31 -080081 struct dk_cxlflash_hdr hdr;
Christopher Ferris106b3a82016-08-24 12:15:38 -070082 __u64 context_id_src;
Christopher Ferris05d08e92016-02-04 13:16:38 -080083 __u64 context_id_dst;
84 __u64 adap_fd_src;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080085 __u64 reserved[8];
Christopher Ferris106b3a82016-08-24 12:15:38 -070086};
Christopher Ferris05d08e92016-02-04 13:16:38 -080087#define DK_CXLFLASH_VERIFY_SENSE_LEN 18
88#define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -080089struct dk_cxlflash_verify {
Christopher Ferris106b3a82016-08-24 12:15:38 -070090 struct dk_cxlflash_hdr hdr;
Christopher Ferris05d08e92016-02-04 13:16:38 -080091 __u64 context_id;
92 __u64 rsrc_handle;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080093 __u64 hint;
Christopher Ferris106b3a82016-08-24 12:15:38 -070094 __u64 last_lba;
Christopher Ferris05d08e92016-02-04 13:16:38 -080095 __u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN];
96 __u8 pad[6];
Christopher Ferris6a9755d2017-01-13 14:09:31 -080097 __u64 reserved[8];
Christopher Ferris106b3a82016-08-24 12:15:38 -070098};
Christopher Ferris05d08e92016-02-04 13:16:38 -080099#define DK_CXLFLASH_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL
100struct dk_cxlflash_recover_afu {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800101 struct dk_cxlflash_hdr hdr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700102 __u64 reason;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800103 __u64 context_id;
104 __u64 mmio_size;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800105 __u64 adap_fd;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700106 __u64 reserved[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800108#define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800109#define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -0700110#define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800111#define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL
112struct dk_cxlflash_manage_lun {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800113 struct dk_cxlflash_hdr hdr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700114 __u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800115 __u64 reserved[8];
116};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800117union cxlflash_ioctls {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700118 struct dk_cxlflash_attach attach;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800119 struct dk_cxlflash_detach detach;
120 struct dk_cxlflash_udirect udirect;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800121 struct dk_cxlflash_uvirtual uvirtual;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700122 struct dk_cxlflash_release release;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800123 struct dk_cxlflash_resize resize;
124 struct dk_cxlflash_clone clone;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800125 struct dk_cxlflash_verify verify;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700126 struct dk_cxlflash_recover_afu recover_afu;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800127 struct dk_cxlflash_manage_lun manage_lun;
128};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800129#define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls))
Christopher Ferris106b3a82016-08-24 12:15:38 -0700130#define CXL_MAGIC 0xCA
Christopher Ferris05d08e92016-02-04 13:16:38 -0800131#define CXL_IOWR(_n,_s) _IOWR(CXL_MAGIC, _n, struct _s)
132#define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800133#define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700134#define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800135#define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach)
136#define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800137#define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700138#define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800139#define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual)
140#define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800141#define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone)
Christopher Ferris1308ad32017-11-14 17:32:13 -0800142#define HT_CXLFLASH_VERSION_0 0
143struct ht_cxlflash_hdr {
144 __u16 version;
145 __u16 subcmd;
146 __u16 rsvd[2];
147 __u64 flags;
148 __u64 return_flags;
149};
150#define HT_CXLFLASH_HOST_READ 0x0000000000000000ULL
151#define HT_CXLFLASH_HOST_WRITE 0x0000000000000001ULL
152#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_CREATE_LUN 0x0001
153#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_DELETE_LUN 0x0002
154#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_QUERY_PORT 0x0003
155struct ht_cxlflash_lun_provision {
156 struct ht_cxlflash_hdr hdr;
157 __u16 port;
158 __u16 reserved16[3];
159 __u64 size;
160 __u64 lun_id;
161 __u8 wwid[CXLFLASH_WWID_LEN];
162 __u64 max_num_luns;
163 __u64 cur_num_luns;
164 __u64 max_cap_port;
165 __u64 cur_cap_port;
166 __u64 reserved[8];
167};
168#define HT_CXLFLASH_AFU_DEBUG_MAX_DATA_LEN 262144
169#define HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN 12
170struct ht_cxlflash_afu_debug {
171 struct ht_cxlflash_hdr hdr;
172 __u8 reserved8[4];
173 __u8 afu_subcmd[HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN];
174 __u64 data_ea;
175 __u32 data_len;
176 __u32 reserved32;
177 __u64 reserved[8];
178};
179union cxlflash_ht_ioctls {
180 struct ht_cxlflash_lun_provision lun_provision;
181 struct ht_cxlflash_afu_debug afu_debug;
182};
183#define MAX_HT_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ht_ioctls))
184#define HT_CXLFLASH_LUN_PROVISION CXL_IOWR(0xBF, ht_cxlflash_lun_provision)
185#define HT_CXLFLASH_AFU_DEBUG CXL_IOWR(0xBE, ht_cxlflash_afu_debug)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700186#endif