• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 _UAPI_MISC_CXL_H
20 #define _UAPI_MISC_CXL_H
21 #include <linux/types.h>
22 #include <linux/ioctl.h>
23 struct cxl_ioctl_start_work {
24   __u64 flags;
25   __u64 work_element_descriptor;
26   __u64 amr;
27   __s16 num_interrupts;
28   __u16 tid;
29   __s32 reserved1;
30   __u64 reserved2;
31   __u64 reserved3;
32   __u64 reserved4;
33   __u64 reserved5;
34 };
35 #define CXL_START_WORK_AMR 0x0000000000000001ULL
36 #define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
37 #define CXL_START_WORK_ERR_FF 0x0000000000000004ULL
38 #define CXL_START_WORK_TID 0x0000000000000008ULL
39 #define CXL_START_WORK_ALL (CXL_START_WORK_AMR | CXL_START_WORK_NUM_IRQS | CXL_START_WORK_ERR_FF | CXL_START_WORK_TID)
40 #define CXL_MODE_DEDICATED 0x1
41 #define CXL_MODE_DIRECTED 0x2
42 #define CXL_AFUID_FLAG_SLAVE 0x1
43 struct cxl_afu_id {
44   __u64 flags;
45   __u32 card_id;
46   __u32 afu_offset;
47   __u32 afu_mode;
48   __u32 reserved1;
49   __u64 reserved2;
50   __u64 reserved3;
51   __u64 reserved4;
52   __u64 reserved5;
53   __u64 reserved6;
54 };
55 #define CXL_AI_NEED_HEADER 0x0000000000000001ULL
56 #define CXL_AI_ALL CXL_AI_NEED_HEADER
57 #define CXL_AI_HEADER_SIZE 128
58 #define CXL_AI_BUFFER_SIZE 4096
59 #define CXL_AI_MAX_ENTRIES 256
60 #define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES)
61 struct cxl_adapter_image {
62   __u64 flags;
63   __u64 data;
64   __u64 len_data;
65   __u64 len_image;
66   __u64 reserved1;
67   __u64 reserved2;
68   __u64 reserved3;
69   __u64 reserved4;
70 };
71 #define CXL_MAGIC 0xCA
72 #define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
73 #define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32)
74 #define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id)
75 #define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image)
76 #define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image)
77 #define CXL_READ_MIN_SIZE 0x1000
78 enum cxl_event_type {
79   CXL_EVENT_RESERVED = 0,
80   CXL_EVENT_AFU_INTERRUPT = 1,
81   CXL_EVENT_DATA_STORAGE = 2,
82   CXL_EVENT_AFU_ERROR = 3,
83   CXL_EVENT_AFU_DRIVER = 4,
84 };
85 struct cxl_event_header {
86   __u16 type;
87   __u16 size;
88   __u16 process_element;
89   __u16 reserved1;
90 };
91 struct cxl_event_afu_interrupt {
92   __u16 flags;
93   __u16 irq;
94   __u32 reserved1;
95 };
96 struct cxl_event_data_storage {
97   __u16 flags;
98   __u16 reserved1;
99   __u32 reserved2;
100   __u64 addr;
101   __u64 dsisr;
102   __u64 reserved3;
103 };
104 struct cxl_event_afu_error {
105   __u16 flags;
106   __u16 reserved1;
107   __u32 reserved2;
108   __u64 error;
109 };
110 struct cxl_event_afu_driver_reserved {
111   __u32 data_size;
112   __u8 data[];
113 };
114 struct cxl_event {
115   struct cxl_event_header header;
116   union {
117     struct cxl_event_afu_interrupt irq;
118     struct cxl_event_data_storage fault;
119     struct cxl_event_afu_error afu_error;
120     struct cxl_event_afu_driver_reserved afu_driver_event;
121   };
122 };
123 #endif
124