105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris/****************************************************************************
205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ****************************************************************************
305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***
405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   This header was automatically generated from a Linux kernel header
505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   of the same name, to make information necessary for userspace to
605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   call into the kernel available to libc.  It contains only constants,
705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   structures, and macros generated from the original header, and thus,
805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   contains no copyrightable information.
905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***
1005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   To edit the content of this header, modify the corresponding
1105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   source file (e.g. under external/kernel-headers/original/) then
1205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   run bionic/libc/kernel/tools/update_all.py
1305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***
1405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   Any manual change here will be lost the next time this script will
1505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***   be run. You've been warned!
1605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ***
1705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ****************************************************************************
1805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris ****************************************************************************/
1905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#ifndef _CXLFLASH_IOCTL_H
2005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define _CXLFLASH_IOCTL_H
2105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#include <linux/types.h>
221308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define CXLFLASH_WWID_LEN 16
2305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_VERSION_0 0
2405d08e9716b5974d6ed08973f44930804890b902Christopher Ferrisstruct dk_cxlflash_hdr {
2505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u16 version;
2605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u16 rsvd[3];
2705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 flags;
2805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 return_flags;
2905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
30106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL
316a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL
32525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris#define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL
336a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL
34106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisstruct dk_cxlflash_attach {
3505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_hdr hdr;
3605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 num_interrupts;
376a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 context_id;
38106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 mmio_size;
3905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 block_size;
4005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 adap_fd;
416a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 last_lba;
42106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 max_xfer;
4305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved[8];
4405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
456a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferrisstruct dk_cxlflash_detach {
46106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  struct dk_cxlflash_hdr hdr;
4705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 context_id;
4805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved[8];
496a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris};
50106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisstruct dk_cxlflash_udirect {
5105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_hdr hdr;
5205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 context_id;
536a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 rsrc_handle;
54106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 last_lba;
5505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved[8];
5605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
576a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL
58106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisstruct dk_cxlflash_uvirtual {
5905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_hdr hdr;
6005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 context_id;
616a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 lun_size;
62106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 rsrc_handle;
6305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 last_lba;
6405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved[8];
656a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris};
66106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisstruct dk_cxlflash_release {
6705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_hdr hdr;
6805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 context_id;
696a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 rsrc_handle;
70106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 reserved[8];
7105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
7205d08e9716b5974d6ed08973f44930804890b902Christopher Ferrisstruct dk_cxlflash_resize {
736a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  struct dk_cxlflash_hdr hdr;
74106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 context_id;
7505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 rsrc_handle;
7605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 req_size;
776a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 last_lba;
78106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 reserved[8];
7905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
8005d08e9716b5974d6ed08973f44930804890b902Christopher Ferrisstruct dk_cxlflash_clone {
816a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  struct dk_cxlflash_hdr hdr;
82106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 context_id_src;
8305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 context_id_dst;
8405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 adap_fd_src;
856a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 reserved[8];
86106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris};
8705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_VERIFY_SENSE_LEN 18
8805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL
896a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferrisstruct dk_cxlflash_verify {
90106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  struct dk_cxlflash_hdr hdr;
9105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 context_id;
9205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 rsrc_handle;
936a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 hint;
94106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 last_lba;
9505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN];
9605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u8 pad[6];
976a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 reserved[8];
98106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris};
9905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL
10005d08e9716b5974d6ed08973f44930804890b902Christopher Ferrisstruct dk_cxlflash_recover_afu {
1016a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  struct dk_cxlflash_hdr hdr;
102106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 reason;
10305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 context_id;
10405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 mmio_size;
1056a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 adap_fd;
106106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 reserved[8];
10705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
1081308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN
1096a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL
110106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL
11105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL
11205d08e9716b5974d6ed08973f44930804890b902Christopher Ferrisstruct dk_cxlflash_manage_lun {
1136a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  struct dk_cxlflash_hdr hdr;
114106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN];
11505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved[8];
11605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
1176a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferrisunion cxlflash_ioctls {
118106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  struct dk_cxlflash_attach attach;
11905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_detach detach;
12005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_udirect udirect;
1216a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  struct dk_cxlflash_uvirtual uvirtual;
122106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  struct dk_cxlflash_release release;
12305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_resize resize;
12405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_clone clone;
1256a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  struct dk_cxlflash_verify verify;
126106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  struct dk_cxlflash_recover_afu recover_afu;
12705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct dk_cxlflash_manage_lun manage_lun;
12805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
1296a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls))
130106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_MAGIC 0xCA
13105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define CXL_IOWR(_n,_s) _IOWR(CXL_MAGIC, _n, struct _s)
13205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach)
1336a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect)
134106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release)
13505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach)
13605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify)
1376a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu)
138106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun)
13905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual)
14005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize)
1416a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone)
1421308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_VERSION_0 0
1431308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferrisstruct ht_cxlflash_hdr {
1441308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u16 version;
1451308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u16 subcmd;
1461308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u16 rsvd[2];
1471308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 flags;
1481308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 return_flags;
1491308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris};
1501308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_HOST_READ 0x0000000000000000ULL
1511308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_HOST_WRITE 0x0000000000000001ULL
1521308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_CREATE_LUN 0x0001
1531308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_DELETE_LUN 0x0002
1541308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_QUERY_PORT 0x0003
1551308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferrisstruct ht_cxlflash_lun_provision {
1561308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  struct ht_cxlflash_hdr hdr;
1571308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u16 port;
1581308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u16 reserved16[3];
1591308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 size;
1601308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 lun_id;
1611308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u8 wwid[CXLFLASH_WWID_LEN];
1621308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 max_num_luns;
1631308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 cur_num_luns;
1641308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 max_cap_port;
1651308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 cur_cap_port;
1661308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 reserved[8];
1671308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris};
1681308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_AFU_DEBUG_MAX_DATA_LEN 262144
1691308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN 12
1701308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferrisstruct ht_cxlflash_afu_debug {
1711308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  struct ht_cxlflash_hdr hdr;
1721308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u8 reserved8[4];
1731308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u8 afu_subcmd[HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN];
1741308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 data_ea;
1751308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u32 data_len;
1761308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u32 reserved32;
1771308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 reserved[8];
1781308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris};
1791308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferrisunion cxlflash_ht_ioctls {
1801308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  struct ht_cxlflash_lun_provision lun_provision;
1811308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  struct ht_cxlflash_afu_debug afu_debug;
1821308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris};
1831308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define MAX_HT_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ht_ioctls))
1841308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_LUN_PROVISION CXL_IOWR(0xBF, ht_cxlflash_lun_provision)
1851308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define HT_CXLFLASH_AFU_DEBUG CXL_IOWR(0xBE, ht_cxlflash_afu_debug)
186106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#endif
187