122851890Sopenharmony_ci/****************************************************************************
222851890Sopenharmony_ci ****************************************************************************
322851890Sopenharmony_ci ***
422851890Sopenharmony_ci ***   This header was automatically generated from a Linux kernel header
522851890Sopenharmony_ci ***   of the same name, to make information necessary for userspace to
622851890Sopenharmony_ci ***   call into the kernel available to libc.  It contains only constants,
722851890Sopenharmony_ci ***   structures, and macros generated from the original header, and thus,
822851890Sopenharmony_ci ***   contains no copyrightable information.
922851890Sopenharmony_ci ***
1022851890Sopenharmony_ci ***   To edit the content of this header, modify the corresponding
1122851890Sopenharmony_ci ***   source file (e.g. under external/kernel-headers/original/) then
1222851890Sopenharmony_ci ***   run bionic/libc/kernel/tools/update_all.py
1322851890Sopenharmony_ci ***
1422851890Sopenharmony_ci ***   Any manual change here will be lost the next time this script will
1522851890Sopenharmony_ci ***   be run. You've been warned!
1622851890Sopenharmony_ci ***
1722851890Sopenharmony_ci ****************************************************************************
1822851890Sopenharmony_ci ****************************************************************************/
1922851890Sopenharmony_ci#ifndef _UAPI_MISC_CXL_H
2022851890Sopenharmony_ci#define _UAPI_MISC_CXL_H
2122851890Sopenharmony_ci#include <linux/types.h>
2222851890Sopenharmony_ci#include <linux/ioctl.h>
2322851890Sopenharmony_cistruct cxl_ioctl_start_work {
2422851890Sopenharmony_ci  __u64 flags;
2522851890Sopenharmony_ci  __u64 work_element_descriptor;
2622851890Sopenharmony_ci  __u64 amr;
2722851890Sopenharmony_ci  __s16 num_interrupts;
2822851890Sopenharmony_ci  __u16 tid;
2922851890Sopenharmony_ci  __s32 reserved1;
3022851890Sopenharmony_ci  __u64 reserved2;
3122851890Sopenharmony_ci  __u64 reserved3;
3222851890Sopenharmony_ci  __u64 reserved4;
3322851890Sopenharmony_ci  __u64 reserved5;
3422851890Sopenharmony_ci};
3522851890Sopenharmony_ci#define CXL_START_WORK_AMR 0x0000000000000001ULL
3622851890Sopenharmony_ci#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
3722851890Sopenharmony_ci#define CXL_START_WORK_ERR_FF 0x0000000000000004ULL
3822851890Sopenharmony_ci#define CXL_START_WORK_TID 0x0000000000000008ULL
3922851890Sopenharmony_ci#define CXL_START_WORK_ALL (CXL_START_WORK_AMR | CXL_START_WORK_NUM_IRQS | CXL_START_WORK_ERR_FF | CXL_START_WORK_TID)
4022851890Sopenharmony_ci#define CXL_MODE_DEDICATED 0x1
4122851890Sopenharmony_ci#define CXL_MODE_DIRECTED 0x2
4222851890Sopenharmony_ci#define CXL_AFUID_FLAG_SLAVE 0x1
4322851890Sopenharmony_cistruct cxl_afu_id {
4422851890Sopenharmony_ci  __u64 flags;
4522851890Sopenharmony_ci  __u32 card_id;
4622851890Sopenharmony_ci  __u32 afu_offset;
4722851890Sopenharmony_ci  __u32 afu_mode;
4822851890Sopenharmony_ci  __u32 reserved1;
4922851890Sopenharmony_ci  __u64 reserved2;
5022851890Sopenharmony_ci  __u64 reserved3;
5122851890Sopenharmony_ci  __u64 reserved4;
5222851890Sopenharmony_ci  __u64 reserved5;
5322851890Sopenharmony_ci  __u64 reserved6;
5422851890Sopenharmony_ci};
5522851890Sopenharmony_ci#define CXL_AI_NEED_HEADER 0x0000000000000001ULL
5622851890Sopenharmony_ci#define CXL_AI_ALL CXL_AI_NEED_HEADER
5722851890Sopenharmony_ci#define CXL_AI_HEADER_SIZE 128
5822851890Sopenharmony_ci#define CXL_AI_BUFFER_SIZE 4096
5922851890Sopenharmony_ci#define CXL_AI_MAX_ENTRIES 256
6022851890Sopenharmony_ci#define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES)
6122851890Sopenharmony_cistruct cxl_adapter_image {
6222851890Sopenharmony_ci  __u64 flags;
6322851890Sopenharmony_ci  __u64 data;
6422851890Sopenharmony_ci  __u64 len_data;
6522851890Sopenharmony_ci  __u64 len_image;
6622851890Sopenharmony_ci  __u64 reserved1;
6722851890Sopenharmony_ci  __u64 reserved2;
6822851890Sopenharmony_ci  __u64 reserved3;
6922851890Sopenharmony_ci  __u64 reserved4;
7022851890Sopenharmony_ci};
7122851890Sopenharmony_ci#define CXL_MAGIC 0xCA
7222851890Sopenharmony_ci#define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
7322851890Sopenharmony_ci#define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32)
7422851890Sopenharmony_ci#define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id)
7522851890Sopenharmony_ci#define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image)
7622851890Sopenharmony_ci#define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image)
7722851890Sopenharmony_ci#define CXL_READ_MIN_SIZE 0x1000
7822851890Sopenharmony_cienum cxl_event_type {
7922851890Sopenharmony_ci  CXL_EVENT_RESERVED = 0,
8022851890Sopenharmony_ci  CXL_EVENT_AFU_INTERRUPT = 1,
8122851890Sopenharmony_ci  CXL_EVENT_DATA_STORAGE = 2,
8222851890Sopenharmony_ci  CXL_EVENT_AFU_ERROR = 3,
8322851890Sopenharmony_ci  CXL_EVENT_AFU_DRIVER = 4,
8422851890Sopenharmony_ci};
8522851890Sopenharmony_cistruct cxl_event_header {
8622851890Sopenharmony_ci  __u16 type;
8722851890Sopenharmony_ci  __u16 size;
8822851890Sopenharmony_ci  __u16 process_element;
8922851890Sopenharmony_ci  __u16 reserved1;
9022851890Sopenharmony_ci};
9122851890Sopenharmony_cistruct cxl_event_afu_interrupt {
9222851890Sopenharmony_ci  __u16 flags;
9322851890Sopenharmony_ci  __u16 irq;
9422851890Sopenharmony_ci  __u32 reserved1;
9522851890Sopenharmony_ci};
9622851890Sopenharmony_cistruct cxl_event_data_storage {
9722851890Sopenharmony_ci  __u16 flags;
9822851890Sopenharmony_ci  __u16 reserved1;
9922851890Sopenharmony_ci  __u32 reserved2;
10022851890Sopenharmony_ci  __u64 addr;
10122851890Sopenharmony_ci  __u64 dsisr;
10222851890Sopenharmony_ci  __u64 reserved3;
10322851890Sopenharmony_ci};
10422851890Sopenharmony_cistruct cxl_event_afu_error {
10522851890Sopenharmony_ci  __u16 flags;
10622851890Sopenharmony_ci  __u16 reserved1;
10722851890Sopenharmony_ci  __u32 reserved2;
10822851890Sopenharmony_ci  __u64 error;
10922851890Sopenharmony_ci};
11022851890Sopenharmony_cistruct cxl_event_afu_driver_reserved {
11122851890Sopenharmony_ci  __u32 data_size;
11222851890Sopenharmony_ci  __u8 data[];
11322851890Sopenharmony_ci};
11422851890Sopenharmony_cistruct cxl_event {
11522851890Sopenharmony_ci  struct cxl_event_header header;
11622851890Sopenharmony_ci  union {
11722851890Sopenharmony_ci    struct cxl_event_afu_interrupt irq;
11822851890Sopenharmony_ci    struct cxl_event_data_storage fault;
11922851890Sopenharmony_ci    struct cxl_event_afu_error afu_error;
12022851890Sopenharmony_ci    struct cxl_event_afu_driver_reserved afu_driver_event;
12122851890Sopenharmony_ci  };
12222851890Sopenharmony_ci};
12322851890Sopenharmony_ci#endif
124