182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris/****************************************************************************
282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ****************************************************************************
382d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***
482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   This header was automatically generated from a Linux kernel header
582d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   of the same name, to make information necessary for userspace to
682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   call into the kernel available to libc.  It contains only constants,
782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   structures, and macros generated from the original header, and thus,
882d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   contains no copyrightable information.
982d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***
1082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   To edit the content of this header, modify the corresponding
1182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   source file (e.g. under external/kernel-headers/original/) then
1282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   run bionic/libc/kernel/tools/update_all.py
1382d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***
1482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   Any manual change here will be lost the next time this script will
1582d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***   be run. You've been warned!
1682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ***
1782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ****************************************************************************
1882d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris ****************************************************************************/
1982d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#ifndef _UAPI_MISC_CXL_H
2082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define _UAPI_MISC_CXL_H
2182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#include <linux/types.h>
2282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#include <linux/ioctl.h>
2382d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct cxl_ioctl_start_work {
24d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 flags;
25d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 work_element_descriptor;
26d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 amr;
27d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __s16 num_interrupts;
28d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __s16 reserved1;
29d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __s32 reserved2;
30d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 reserved3;
31d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 reserved4;
32d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 reserved5;
33d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 reserved6;
3482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
3582d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define CXL_START_WORK_AMR 0x0000000000000001ULL
3682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
3705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define CXL_START_WORK_ERR_FF 0x0000000000000004ULL
3805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define CXL_START_WORK_ALL (CXL_START_WORK_AMR | CXL_START_WORK_NUM_IRQS | CXL_START_WORK_ERR_FF)
3905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define CXL_MODE_DEDICATED 0x1
4005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define CXL_MODE_DIRECTED 0x2
4105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define CXL_AFUID_FLAG_SLAVE 0x1
4205d08e9716b5974d6ed08973f44930804890b902Christopher Ferrisstruct cxl_afu_id {
4305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 flags;
4405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 card_id;
4505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 afu_offset;
4605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 afu_mode;
4705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 reserved1;
4805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved2;
4905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved3;
5005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved4;
5105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved5;
5205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reserved6;
5305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
54106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_AI_NEED_HEADER 0x0000000000000001ULL
55106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_AI_ALL CXL_AI_NEED_HEADER
56106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_AI_HEADER_SIZE 128
57106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_AI_BUFFER_SIZE 4096
58106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_AI_MAX_ENTRIES 256
59106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES)
60106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisstruct cxl_adapter_image {
61106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 flags;
62106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 data;
63106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 len_data;
64106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 len_image;
65106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 reserved1;
66106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 reserved2;
67106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 reserved3;
68106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris  __u64 reserved4;
69106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris};
7082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define CXL_MAGIC 0xCA
7182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
7282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32)
7305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris#define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id)
74106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image)
75106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image)
76106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define CXL_READ_MIN_SIZE 0x1000
7705d08e9716b5974d6ed08973f44930804890b902Christopher Ferrisenum cxl_event_type {
78d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  CXL_EVENT_RESERVED = 0,
79d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  CXL_EVENT_AFU_INTERRUPT = 1,
80d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  CXL_EVENT_DATA_STORAGE = 2,
8105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  CXL_EVENT_AFU_ERROR = 3,
8249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  CXL_EVENT_AFU_DRIVER = 4,
8349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
8482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct cxl_event_header {
85d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 type;
8605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u16 size;
8749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u16 process_element;
88d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 reserved1;
8982d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
9005d08e9716b5974d6ed08973f44930804890b902Christopher Ferrisstruct cxl_event_afu_interrupt {
9149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u16 flags;
92d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 irq;
93d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 reserved1;
9405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
9549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct cxl_event_data_storage {
96d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 flags;
97d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 reserved1;
9805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 reserved2;
9949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u64 addr;
100d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 dsisr;
101d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 reserved3;
10205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris};
10349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct cxl_event_afu_error {
104d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 flags;
105d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 reserved1;
10605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 reserved2;
107d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 error;
10849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
10949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct cxl_event_afu_driver_reserved {
11049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u32 data_size;
11149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 data[];
11282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
11382d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct cxl_event {
11405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  struct cxl_event_header header;
11549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  union {
116d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct cxl_event_afu_interrupt irq;
117d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct cxl_event_data_storage fault;
11805d08e9716b5974d6ed08973f44930804890b902Christopher Ferris    struct cxl_event_afu_error afu_error;
11949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris    struct cxl_event_afu_driver_reserved afu_driver_event;
12049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  };
12182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
12282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#endif
123