blob: 64b59926412860375a2638553eeb5d54ec201342 [file] [log] [blame]
Christopher Ferris82d75042015-01-26 10:57:07 -08001/****************************************************************************
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>
Christopher Ferris82d75042015-01-26 10:57:07 -080023struct cxl_ioctl_start_work {
Tao Baod7db5942015-01-28 10:07:51 -080024 __u64 flags;
25 __u64 work_element_descriptor;
26 __u64 amr;
Tao Baod7db5942015-01-28 10:07:51 -080027 __s16 num_interrupts;
Christopher Ferris76a1d452018-06-27 14:12:29 -070028 __u16 tid;
29 __s32 reserved1;
30 __u64 reserved2;
Tao Baod7db5942015-01-28 10:07:51 -080031 __u64 reserved3;
Tao Baod7db5942015-01-28 10:07:51 -080032 __u64 reserved4;
33 __u64 reserved5;
Christopher Ferris82d75042015-01-26 10:57:07 -080034};
Christopher Ferris82d75042015-01-26 10:57:07 -080035#define CXL_START_WORK_AMR 0x0000000000000001ULL
36#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -080037#define CXL_START_WORK_ERR_FF 0x0000000000000004ULL
Christopher Ferris76a1d452018-06-27 14:12:29 -070038#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)
Christopher Ferris05d08e92016-02-04 13:16:38 -080040#define CXL_MODE_DEDICATED 0x1
41#define CXL_MODE_DIRECTED 0x2
42#define CXL_AFUID_FLAG_SLAVE 0x1
43struct cxl_afu_id {
Christopher Ferris05d08e92016-02-04 13:16:38 -080044 __u64 flags;
45 __u32 card_id;
46 __u32 afu_offset;
47 __u32 afu_mode;
Christopher Ferris05d08e92016-02-04 13:16:38 -080048 __u32 reserved1;
49 __u64 reserved2;
50 __u64 reserved3;
51 __u64 reserved4;
Christopher Ferris05d08e92016-02-04 13:16:38 -080052 __u64 reserved5;
53 __u64 reserved6;
54};
Christopher Ferris106b3a82016-08-24 12:15:38 -070055#define CXL_AI_NEED_HEADER 0x0000000000000001ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070056#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
Christopher Ferris106b3a82016-08-24 12:15:38 -070060#define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES)
61struct cxl_adapter_image {
62 __u64 flags;
63 __u64 data;
Christopher Ferris106b3a82016-08-24 12:15:38 -070064 __u64 len_data;
65 __u64 len_image;
66 __u64 reserved1;
67 __u64 reserved2;
Christopher Ferris106b3a82016-08-24 12:15:38 -070068 __u64 reserved3;
69 __u64 reserved4;
70};
Christopher Ferris82d75042015-01-26 10:57:07 -080071#define CXL_MAGIC 0xCA
Christopher Ferris82d75042015-01-26 10:57:07 -080072#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)
Christopher Ferris05d08e92016-02-04 13:16:38 -080074#define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id)
Christopher Ferris106b3a82016-08-24 12:15:38 -070075#define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image)
Christopher Ferris106b3a82016-08-24 12:15:38 -070076#define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image)
77#define CXL_READ_MIN_SIZE 0x1000
Christopher Ferris05d08e92016-02-04 13:16:38 -080078enum cxl_event_type {
Tao Baod7db5942015-01-28 10:07:51 -080079 CXL_EVENT_RESERVED = 0,
80 CXL_EVENT_AFU_INTERRUPT = 1,
81 CXL_EVENT_DATA_STORAGE = 2,
Christopher Ferris05d08e92016-02-04 13:16:38 -080082 CXL_EVENT_AFU_ERROR = 3,
Christopher Ferris49f525c2016-12-12 14:55:36 -080083 CXL_EVENT_AFU_DRIVER = 4,
Christopher Ferris49f525c2016-12-12 14:55:36 -080084};
Christopher Ferris82d75042015-01-26 10:57:07 -080085struct cxl_event_header {
Tao Baod7db5942015-01-28 10:07:51 -080086 __u16 type;
Christopher Ferris05d08e92016-02-04 13:16:38 -080087 __u16 size;
Christopher Ferris49f525c2016-12-12 14:55:36 -080088 __u16 process_element;
Tao Baod7db5942015-01-28 10:07:51 -080089 __u16 reserved1;
Christopher Ferris82d75042015-01-26 10:57:07 -080090};
Christopher Ferris05d08e92016-02-04 13:16:38 -080091struct cxl_event_afu_interrupt {
Christopher Ferris49f525c2016-12-12 14:55:36 -080092 __u16 flags;
Tao Baod7db5942015-01-28 10:07:51 -080093 __u16 irq;
94 __u32 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080095};
Christopher Ferris49f525c2016-12-12 14:55:36 -080096struct cxl_event_data_storage {
Tao Baod7db5942015-01-28 10:07:51 -080097 __u16 flags;
98 __u16 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080099 __u32 reserved2;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800100 __u64 addr;
Tao Baod7db5942015-01-28 10:07:51 -0800101 __u64 dsisr;
102 __u64 reserved3;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800103};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800104struct cxl_event_afu_error {
Tao Baod7db5942015-01-28 10:07:51 -0800105 __u16 flags;
106 __u16 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107 __u32 reserved2;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800108 __u64 error;
109};
110struct cxl_event_afu_driver_reserved {
111 __u32 data_size;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800112 __u8 data[];
Christopher Ferris82d75042015-01-26 10:57:07 -0800113};
114struct cxl_event {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800115 struct cxl_event_header header;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800116 union {
Tao Baod7db5942015-01-28 10:07:51 -0800117 struct cxl_event_afu_interrupt irq;
118 struct cxl_event_data_storage fault;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800119 struct cxl_event_afu_error afu_error;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800120 struct cxl_event_afu_driver_reserved afu_driver_event;
121 };
Christopher Ferris82d75042015-01-26 10:57:07 -0800122};
123#endif