• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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  */
7 #ifndef _CXLFLASH_IOCTL_H
8 #define _CXLFLASH_IOCTL_H
9 #include <linux/types.h>
10 #define CXLFLASH_WWID_LEN 16
11 #define DK_CXLFLASH_VERSION_0 0
12 struct dk_cxlflash_hdr {
13   __u16 version;
14   __u16 rsvd[3];
15   __u64 flags;
16   __u64 return_flags;
17 };
18 #define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL
19 #define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL
20 #define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL
21 #define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL
22 struct dk_cxlflash_attach {
23   struct dk_cxlflash_hdr hdr;
24   __u64 num_interrupts;
25   __u64 context_id;
26   __u64 mmio_size;
27   __u64 block_size;
28   __u64 adap_fd;
29   __u64 last_lba;
30   __u64 max_xfer;
31   __u64 reserved[8];
32 };
33 struct dk_cxlflash_detach {
34   struct dk_cxlflash_hdr hdr;
35   __u64 context_id;
36   __u64 reserved[8];
37 };
38 struct dk_cxlflash_udirect {
39   struct dk_cxlflash_hdr hdr;
40   __u64 context_id;
41   __u64 rsrc_handle;
42   __u64 last_lba;
43   __u64 reserved[8];
44 };
45 #define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL
46 struct dk_cxlflash_uvirtual {
47   struct dk_cxlflash_hdr hdr;
48   __u64 context_id;
49   __u64 lun_size;
50   __u64 rsrc_handle;
51   __u64 last_lba;
52   __u64 reserved[8];
53 };
54 struct dk_cxlflash_release {
55   struct dk_cxlflash_hdr hdr;
56   __u64 context_id;
57   __u64 rsrc_handle;
58   __u64 reserved[8];
59 };
60 struct dk_cxlflash_resize {
61   struct dk_cxlflash_hdr hdr;
62   __u64 context_id;
63   __u64 rsrc_handle;
64   __u64 req_size;
65   __u64 last_lba;
66   __u64 reserved[8];
67 };
68 struct dk_cxlflash_clone {
69   struct dk_cxlflash_hdr hdr;
70   __u64 context_id_src;
71   __u64 context_id_dst;
72   __u64 adap_fd_src;
73   __u64 reserved[8];
74 };
75 #define DK_CXLFLASH_VERIFY_SENSE_LEN 18
76 #define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL
77 struct dk_cxlflash_verify {
78   struct dk_cxlflash_hdr hdr;
79   __u64 context_id;
80   __u64 rsrc_handle;
81   __u64 hint;
82   __u64 last_lba;
83   __u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN];
84   __u8 pad[6];
85   __u64 reserved[8];
86 };
87 #define DK_CXLFLASH_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL
88 struct dk_cxlflash_recover_afu {
89   struct dk_cxlflash_hdr hdr;
90   __u64 reason;
91   __u64 context_id;
92   __u64 mmio_size;
93   __u64 adap_fd;
94   __u64 reserved[8];
95 };
96 #define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN
97 #define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL
98 #define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL
99 #define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL
100 struct dk_cxlflash_manage_lun {
101   struct dk_cxlflash_hdr hdr;
102   __u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN];
103   __u64 reserved[8];
104 };
105 union cxlflash_ioctls {
106   struct dk_cxlflash_attach attach;
107   struct dk_cxlflash_detach detach;
108   struct dk_cxlflash_udirect udirect;
109   struct dk_cxlflash_uvirtual uvirtual;
110   struct dk_cxlflash_release release;
111   struct dk_cxlflash_resize resize;
112   struct dk_cxlflash_clone clone;
113   struct dk_cxlflash_verify verify;
114   struct dk_cxlflash_recover_afu recover_afu;
115   struct dk_cxlflash_manage_lun manage_lun;
116 };
117 #define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls))
118 #define CXL_MAGIC 0xCA
119 #define CXL_IOWR(_n,_s) _IOWR(CXL_MAGIC, _n, struct _s)
120 #define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach)
121 #define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect)
122 #define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release)
123 #define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach)
124 #define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify)
125 #define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu)
126 #define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun)
127 #define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual)
128 #define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize)
129 #define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone)
130 #define HT_CXLFLASH_VERSION_0 0
131 struct 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
143 struct 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
158 struct 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 };
167 union 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)
174 #endif
175