blob: 008b77c2675cdc832e49996fb7386f3f5349a2d0 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferris05d08e92016-02-04 13:16:38 -08007#ifndef _CXLFLASH_IOCTL_H
8#define _CXLFLASH_IOCTL_H
9#include <linux/types.h>
Christopher Ferris1308ad32017-11-14 17:32:13 -080010#define CXLFLASH_WWID_LEN 16
Christopher Ferris05d08e92016-02-04 13:16:38 -080011#define DK_CXLFLASH_VERSION_0 0
Christopher Ferris05d08e92016-02-04 13:16:38 -080012struct dk_cxlflash_hdr {
13 __u16 version;
14 __u16 rsvd[3];
15 __u64 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -080016 __u64 return_flags;
17};
Christopher Ferris106b3a82016-08-24 12:15:38 -070018#define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -080019#define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL
Christopher Ferris525ce912017-07-26 13:12:53 -070020#define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -080021#define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070022struct dk_cxlflash_attach {
Christopher Ferris05d08e92016-02-04 13:16:38 -080023 struct dk_cxlflash_hdr hdr;
24 __u64 num_interrupts;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080025 __u64 context_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -070026 __u64 mmio_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -080027 __u64 block_size;
28 __u64 adap_fd;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080029 __u64 last_lba;
Christopher Ferris106b3a82016-08-24 12:15:38 -070030 __u64 max_xfer;
Christopher Ferris05d08e92016-02-04 13:16:38 -080031 __u64 reserved[8];
32};
Christopher Ferris6a9755d2017-01-13 14:09:31 -080033struct dk_cxlflash_detach {
Christopher Ferris106b3a82016-08-24 12:15:38 -070034 struct dk_cxlflash_hdr hdr;
Christopher Ferris05d08e92016-02-04 13:16:38 -080035 __u64 context_id;
36 __u64 reserved[8];
Christopher Ferris6a9755d2017-01-13 14:09:31 -080037};
Christopher Ferris106b3a82016-08-24 12:15:38 -070038struct dk_cxlflash_udirect {
Christopher Ferris05d08e92016-02-04 13:16:38 -080039 struct dk_cxlflash_hdr hdr;
40 __u64 context_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080041 __u64 rsrc_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -070042 __u64 last_lba;
Christopher Ferris05d08e92016-02-04 13:16:38 -080043 __u64 reserved[8];
44};
Christopher Ferris6a9755d2017-01-13 14:09:31 -080045#define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070046struct dk_cxlflash_uvirtual {
Christopher Ferris05d08e92016-02-04 13:16:38 -080047 struct dk_cxlflash_hdr hdr;
48 __u64 context_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080049 __u64 lun_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -070050 __u64 rsrc_handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -080051 __u64 last_lba;
52 __u64 reserved[8];
Christopher Ferris6a9755d2017-01-13 14:09:31 -080053};
Christopher Ferris106b3a82016-08-24 12:15:38 -070054struct dk_cxlflash_release {
Christopher Ferris05d08e92016-02-04 13:16:38 -080055 struct dk_cxlflash_hdr hdr;
56 __u64 context_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080057 __u64 rsrc_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -070058 __u64 reserved[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -080059};
60struct dk_cxlflash_resize {
Christopher Ferris6a9755d2017-01-13 14:09:31 -080061 struct dk_cxlflash_hdr hdr;
Christopher Ferris106b3a82016-08-24 12:15:38 -070062 __u64 context_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -080063 __u64 rsrc_handle;
64 __u64 req_size;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080065 __u64 last_lba;
Christopher Ferris106b3a82016-08-24 12:15:38 -070066 __u64 reserved[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -080067};
68struct dk_cxlflash_clone {
Christopher Ferris6a9755d2017-01-13 14:09:31 -080069 struct dk_cxlflash_hdr hdr;
Christopher Ferris106b3a82016-08-24 12:15:38 -070070 __u64 context_id_src;
Christopher Ferris05d08e92016-02-04 13:16:38 -080071 __u64 context_id_dst;
72 __u64 adap_fd_src;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080073 __u64 reserved[8];
Christopher Ferris106b3a82016-08-24 12:15:38 -070074};
Christopher Ferris05d08e92016-02-04 13:16:38 -080075#define DK_CXLFLASH_VERIFY_SENSE_LEN 18
76#define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -080077struct dk_cxlflash_verify {
Christopher Ferris106b3a82016-08-24 12:15:38 -070078 struct dk_cxlflash_hdr hdr;
Christopher Ferris05d08e92016-02-04 13:16:38 -080079 __u64 context_id;
80 __u64 rsrc_handle;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080081 __u64 hint;
Christopher Ferris106b3a82016-08-24 12:15:38 -070082 __u64 last_lba;
Christopher Ferris05d08e92016-02-04 13:16:38 -080083 __u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN];
84 __u8 pad[6];
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_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL
88struct dk_cxlflash_recover_afu {
Christopher Ferris6a9755d2017-01-13 14:09:31 -080089 struct dk_cxlflash_hdr hdr;
Christopher Ferris106b3a82016-08-24 12:15:38 -070090 __u64 reason;
Christopher Ferris05d08e92016-02-04 13:16:38 -080091 __u64 context_id;
92 __u64 mmio_size;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080093 __u64 adap_fd;
Christopher Ferris106b3a82016-08-24 12:15:38 -070094 __u64 reserved[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -080095};
Christopher Ferris1308ad32017-11-14 17:32:13 -080096#define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN
Christopher Ferris6a9755d2017-01-13 14:09:31 -080097#define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070098#define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -080099#define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL
100struct dk_cxlflash_manage_lun {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800101 struct dk_cxlflash_hdr hdr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700102 __u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800103 __u64 reserved[8];
104};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800105union cxlflash_ioctls {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700106 struct dk_cxlflash_attach attach;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107 struct dk_cxlflash_detach detach;
108 struct dk_cxlflash_udirect udirect;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800109 struct dk_cxlflash_uvirtual uvirtual;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700110 struct dk_cxlflash_release release;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800111 struct dk_cxlflash_resize resize;
112 struct dk_cxlflash_clone clone;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800113 struct dk_cxlflash_verify verify;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700114 struct dk_cxlflash_recover_afu recover_afu;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800115 struct dk_cxlflash_manage_lun manage_lun;
116};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800117#define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls))
Christopher Ferris106b3a82016-08-24 12:15:38 -0700118#define CXL_MAGIC 0xCA
Christopher Ferris05d08e92016-02-04 13:16:38 -0800119#define CXL_IOWR(_n,_s) _IOWR(CXL_MAGIC, _n, struct _s)
120#define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800121#define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700122#define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800123#define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach)
124#define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800125#define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700126#define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800127#define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual)
128#define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800129#define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone)
Christopher Ferris1308ad32017-11-14 17:32:13 -0800130#define HT_CXLFLASH_VERSION_0 0
131struct ht_cxlflash_hdr {
132 __u16 version;
133 __u16 subcmd;
134 __u16 rsvd[2];
135 __u64 flags;
136 __u64 return_flags;
137};
138#define HT_CXLFLASH_HOST_READ 0x0000000000000000ULL
139#define HT_CXLFLASH_HOST_WRITE 0x0000000000000001ULL
140#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_CREATE_LUN 0x0001
141#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_DELETE_LUN 0x0002
142#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_QUERY_PORT 0x0003
143struct ht_cxlflash_lun_provision {
144 struct ht_cxlflash_hdr hdr;
145 __u16 port;
146 __u16 reserved16[3];
147 __u64 size;
148 __u64 lun_id;
149 __u8 wwid[CXLFLASH_WWID_LEN];
150 __u64 max_num_luns;
151 __u64 cur_num_luns;
152 __u64 max_cap_port;
153 __u64 cur_cap_port;
154 __u64 reserved[8];
155};
156#define HT_CXLFLASH_AFU_DEBUG_MAX_DATA_LEN 262144
157#define HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN 12
158struct ht_cxlflash_afu_debug {
159 struct ht_cxlflash_hdr hdr;
160 __u8 reserved8[4];
161 __u8 afu_subcmd[HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN];
162 __u64 data_ea;
163 __u32 data_len;
164 __u32 reserved32;
165 __u64 reserved[8];
166};
167union cxlflash_ht_ioctls {
168 struct ht_cxlflash_lun_provision lun_provision;
169 struct ht_cxlflash_afu_debug afu_debug;
170};
171#define MAX_HT_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ht_ioctls))
172#define HT_CXLFLASH_LUN_PROVISION CXL_IOWR(0xBF, ht_cxlflash_lun_provision)
173#define HT_CXLFLASH_AFU_DEBUG CXL_IOWR(0xBE, ht_cxlflash_afu_debug)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700174#endif