blob: d05ef53360e772f9072ba4de1f5e635a1ff22b1a [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferris82d75042015-01-26 10:57:07 -08007#ifndef _UAPI_MISC_CXL_H
8#define _UAPI_MISC_CXL_H
9#include <linux/types.h>
10#include <linux/ioctl.h>
Christopher Ferris82d75042015-01-26 10:57:07 -080011struct cxl_ioctl_start_work {
Tao Baod7db5942015-01-28 10:07:51 -080012 __u64 flags;
13 __u64 work_element_descriptor;
14 __u64 amr;
Tao Baod7db5942015-01-28 10:07:51 -080015 __s16 num_interrupts;
Christopher Ferris76a1d452018-06-27 14:12:29 -070016 __u16 tid;
17 __s32 reserved1;
18 __u64 reserved2;
Tao Baod7db5942015-01-28 10:07:51 -080019 __u64 reserved3;
Tao Baod7db5942015-01-28 10:07:51 -080020 __u64 reserved4;
21 __u64 reserved5;
Christopher Ferris82d75042015-01-26 10:57:07 -080022};
Christopher Ferris82d75042015-01-26 10:57:07 -080023#define CXL_START_WORK_AMR 0x0000000000000001ULL
24#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -080025#define CXL_START_WORK_ERR_FF 0x0000000000000004ULL
Christopher Ferris76a1d452018-06-27 14:12:29 -070026#define CXL_START_WORK_TID 0x0000000000000008ULL
27#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 -080028#define CXL_MODE_DEDICATED 0x1
29#define CXL_MODE_DIRECTED 0x2
30#define CXL_AFUID_FLAG_SLAVE 0x1
31struct cxl_afu_id {
Christopher Ferris05d08e92016-02-04 13:16:38 -080032 __u64 flags;
33 __u32 card_id;
34 __u32 afu_offset;
35 __u32 afu_mode;
Christopher Ferris05d08e92016-02-04 13:16:38 -080036 __u32 reserved1;
37 __u64 reserved2;
38 __u64 reserved3;
39 __u64 reserved4;
Christopher Ferris05d08e92016-02-04 13:16:38 -080040 __u64 reserved5;
41 __u64 reserved6;
42};
Christopher Ferris106b3a82016-08-24 12:15:38 -070043#define CXL_AI_NEED_HEADER 0x0000000000000001ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070044#define CXL_AI_ALL CXL_AI_NEED_HEADER
45#define CXL_AI_HEADER_SIZE 128
46#define CXL_AI_BUFFER_SIZE 4096
47#define CXL_AI_MAX_ENTRIES 256
Christopher Ferris106b3a82016-08-24 12:15:38 -070048#define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES)
49struct cxl_adapter_image {
50 __u64 flags;
51 __u64 data;
Christopher Ferris106b3a82016-08-24 12:15:38 -070052 __u64 len_data;
53 __u64 len_image;
54 __u64 reserved1;
55 __u64 reserved2;
Christopher Ferris106b3a82016-08-24 12:15:38 -070056 __u64 reserved3;
57 __u64 reserved4;
58};
Christopher Ferris82d75042015-01-26 10:57:07 -080059#define CXL_MAGIC 0xCA
Christopher Ferris82d75042015-01-26 10:57:07 -080060#define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
61#define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32)
Christopher Ferris05d08e92016-02-04 13:16:38 -080062#define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id)
Christopher Ferris106b3a82016-08-24 12:15:38 -070063#define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image)
Christopher Ferris106b3a82016-08-24 12:15:38 -070064#define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image)
65#define CXL_READ_MIN_SIZE 0x1000
Christopher Ferris05d08e92016-02-04 13:16:38 -080066enum cxl_event_type {
Tao Baod7db5942015-01-28 10:07:51 -080067 CXL_EVENT_RESERVED = 0,
68 CXL_EVENT_AFU_INTERRUPT = 1,
69 CXL_EVENT_DATA_STORAGE = 2,
Christopher Ferris05d08e92016-02-04 13:16:38 -080070 CXL_EVENT_AFU_ERROR = 3,
Christopher Ferris49f525c2016-12-12 14:55:36 -080071 CXL_EVENT_AFU_DRIVER = 4,
Christopher Ferris49f525c2016-12-12 14:55:36 -080072};
Christopher Ferris82d75042015-01-26 10:57:07 -080073struct cxl_event_header {
Tao Baod7db5942015-01-28 10:07:51 -080074 __u16 type;
Christopher Ferris05d08e92016-02-04 13:16:38 -080075 __u16 size;
Christopher Ferris49f525c2016-12-12 14:55:36 -080076 __u16 process_element;
Tao Baod7db5942015-01-28 10:07:51 -080077 __u16 reserved1;
Christopher Ferris82d75042015-01-26 10:57:07 -080078};
Christopher Ferris05d08e92016-02-04 13:16:38 -080079struct cxl_event_afu_interrupt {
Christopher Ferris49f525c2016-12-12 14:55:36 -080080 __u16 flags;
Tao Baod7db5942015-01-28 10:07:51 -080081 __u16 irq;
82 __u32 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080083};
Christopher Ferris49f525c2016-12-12 14:55:36 -080084struct cxl_event_data_storage {
Tao Baod7db5942015-01-28 10:07:51 -080085 __u16 flags;
86 __u16 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080087 __u32 reserved2;
Christopher Ferris49f525c2016-12-12 14:55:36 -080088 __u64 addr;
Tao Baod7db5942015-01-28 10:07:51 -080089 __u64 dsisr;
90 __u64 reserved3;
Christopher Ferris05d08e92016-02-04 13:16:38 -080091};
Christopher Ferris49f525c2016-12-12 14:55:36 -080092struct cxl_event_afu_error {
Tao Baod7db5942015-01-28 10:07:51 -080093 __u16 flags;
94 __u16 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080095 __u32 reserved2;
Christopher Ferris49f525c2016-12-12 14:55:36 -080096 __u64 error;
97};
98struct cxl_event_afu_driver_reserved {
99 __u32 data_size;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800100 __u8 data[];
Christopher Ferris82d75042015-01-26 10:57:07 -0800101};
102struct cxl_event {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800103 struct cxl_event_header header;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800104 union {
Tao Baod7db5942015-01-28 10:07:51 -0800105 struct cxl_event_afu_interrupt irq;
106 struct cxl_event_data_storage fault;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107 struct cxl_event_afu_error afu_error;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800108 struct cxl_event_afu_driver_reserved afu_driver_event;
109 };
Christopher Ferris82d75042015-01-26 10:57:07 -0800110};
111#endif