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