blob: d9cfa5e14d5a517b8a68555786345348537e6d34 [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;
28 __s16 reserved1;
29 __s32 reserved2;
30 __u64 reserved3;
Tao Baod7db5942015-01-28 10:07:51 -080031 __u64 reserved4;
32 __u64 reserved5;
33 __u64 reserved6;
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
38#define CXL_START_WORK_ALL (CXL_START_WORK_AMR | CXL_START_WORK_NUM_IRQS | CXL_START_WORK_ERR_FF)
Christopher Ferris05d08e92016-02-04 13:16:38 -080039#define CXL_MODE_DEDICATED 0x1
40#define CXL_MODE_DIRECTED 0x2
41#define CXL_AFUID_FLAG_SLAVE 0x1
42struct cxl_afu_id {
Christopher Ferris05d08e92016-02-04 13:16:38 -080043 __u64 flags;
44 __u32 card_id;
45 __u32 afu_offset;
46 __u32 afu_mode;
Christopher Ferris05d08e92016-02-04 13:16:38 -080047 __u32 reserved1;
48 __u64 reserved2;
49 __u64 reserved3;
50 __u64 reserved4;
Christopher Ferris05d08e92016-02-04 13:16:38 -080051 __u64 reserved5;
52 __u64 reserved6;
53};
Christopher Ferris106b3a82016-08-24 12:15:38 -070054#define CXL_AI_NEED_HEADER 0x0000000000000001ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070055#define CXL_AI_ALL CXL_AI_NEED_HEADER
56#define CXL_AI_HEADER_SIZE 128
57#define CXL_AI_BUFFER_SIZE 4096
58#define CXL_AI_MAX_ENTRIES 256
Christopher Ferris106b3a82016-08-24 12:15:38 -070059#define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES)
60struct cxl_adapter_image {
61 __u64 flags;
62 __u64 data;
Christopher Ferris106b3a82016-08-24 12:15:38 -070063 __u64 len_data;
64 __u64 len_image;
65 __u64 reserved1;
66 __u64 reserved2;
Christopher Ferris106b3a82016-08-24 12:15:38 -070067 __u64 reserved3;
68 __u64 reserved4;
69};
Christopher Ferris82d75042015-01-26 10:57:07 -080070#define CXL_MAGIC 0xCA
Christopher Ferris82d75042015-01-26 10:57:07 -080071#define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
72#define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32)
Christopher Ferris05d08e92016-02-04 13:16:38 -080073#define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id)
Christopher Ferris106b3a82016-08-24 12:15:38 -070074#define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image)
Christopher Ferris106b3a82016-08-24 12:15:38 -070075#define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image)
76#define CXL_READ_MIN_SIZE 0x1000
Christopher Ferris05d08e92016-02-04 13:16:38 -080077enum cxl_event_type {
Tao Baod7db5942015-01-28 10:07:51 -080078 CXL_EVENT_RESERVED = 0,
79 CXL_EVENT_AFU_INTERRUPT = 1,
80 CXL_EVENT_DATA_STORAGE = 2,
Christopher Ferris05d08e92016-02-04 13:16:38 -080081 CXL_EVENT_AFU_ERROR = 3,
Christopher Ferris49f525c2016-12-12 14:55:36 -080082 CXL_EVENT_AFU_DRIVER = 4,
Christopher Ferris49f525c2016-12-12 14:55:36 -080083};
Christopher Ferris82d75042015-01-26 10:57:07 -080084struct cxl_event_header {
Tao Baod7db5942015-01-28 10:07:51 -080085 __u16 type;
Christopher Ferris05d08e92016-02-04 13:16:38 -080086 __u16 size;
Christopher Ferris49f525c2016-12-12 14:55:36 -080087 __u16 process_element;
Tao Baod7db5942015-01-28 10:07:51 -080088 __u16 reserved1;
Christopher Ferris82d75042015-01-26 10:57:07 -080089};
Christopher Ferris05d08e92016-02-04 13:16:38 -080090struct cxl_event_afu_interrupt {
Christopher Ferris49f525c2016-12-12 14:55:36 -080091 __u16 flags;
Tao Baod7db5942015-01-28 10:07:51 -080092 __u16 irq;
93 __u32 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080094};
Christopher Ferris49f525c2016-12-12 14:55:36 -080095struct cxl_event_data_storage {
Tao Baod7db5942015-01-28 10:07:51 -080096 __u16 flags;
97 __u16 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080098 __u32 reserved2;
Christopher Ferris49f525c2016-12-12 14:55:36 -080099 __u64 addr;
Tao Baod7db5942015-01-28 10:07:51 -0800100 __u64 dsisr;
101 __u64 reserved3;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800102};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800103struct cxl_event_afu_error {
Tao Baod7db5942015-01-28 10:07:51 -0800104 __u16 flags;
105 __u16 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800106 __u32 reserved2;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800107 __u64 error;
108};
109struct cxl_event_afu_driver_reserved {
110 __u32 data_size;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800111 __u8 data[];
Christopher Ferris82d75042015-01-26 10:57:07 -0800112};
113struct cxl_event {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800114 struct cxl_event_header header;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800115 union {
Tao Baod7db5942015-01-28 10:07:51 -0800116 struct cxl_event_afu_interrupt irq;
117 struct cxl_event_data_storage fault;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800118 struct cxl_event_afu_error afu_error;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800119 struct cxl_event_afu_driver_reserved afu_driver_event;
120 };
Christopher Ferris82d75042015-01-26 10:57:07 -0800121};
122#endif