]>
Commit | Line | Data |
---|---|---|
66b43081 IM |
1 | /* |
2 | * Copyright 2014 IBM Corp. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU General Public License | |
6 | * as published by the Free Software Foundation; either version | |
7 | * 2 of the License, or (at your option) any later version. | |
8 | */ | |
9 | ||
10 | #ifndef _UAPI_MISC_CXL_H | |
11 | #define _UAPI_MISC_CXL_H | |
12 | ||
13 | #include <linux/types.h> | |
14 | #include <linux/ioctl.h> | |
15 | ||
a9282d01 | 16 | |
66b43081 IM |
17 | struct cxl_ioctl_start_work { |
18 | __u64 flags; | |
19 | __u64 work_element_descriptor; | |
20 | __u64 amr; | |
21 | __s16 num_interrupts; | |
22 | __s16 reserved1; | |
23 | __s32 reserved2; | |
24 | __u64 reserved3; | |
25 | __u64 reserved4; | |
26 | __u64 reserved5; | |
27 | __u64 reserved6; | |
28 | }; | |
a9282d01 | 29 | |
66b43081 IM |
30 | #define CXL_START_WORK_AMR 0x0000000000000001ULL |
31 | #define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL | |
32 | #define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\ | |
33 | CXL_START_WORK_NUM_IRQS) | |
34 | ||
27d4dc71 VJ |
35 | |
36 | /* Possible modes that an afu can be in */ | |
37 | #define CXL_MODE_DEDICATED 0x1 | |
38 | #define CXL_MODE_DIRECTED 0x2 | |
39 | ||
40 | /* possible flags for the cxl_afu_id flags field */ | |
41 | #define CXL_AFUID_FLAG_SLAVE 0x1 /* In directed-mode afu is in slave mode */ | |
42 | ||
43 | struct cxl_afu_id { | |
44 | __u64 flags; /* One of CXL_AFUID_FLAG_X */ | |
45 | __u32 card_id; | |
46 | __u32 afu_offset; | |
47 | __u32 afu_mode; /* one of the CXL_MODE_X */ | |
48 | __u32 reserved1; | |
49 | __u64 reserved2; | |
50 | __u64 reserved3; | |
51 | __u64 reserved4; | |
52 | __u64 reserved5; | |
53 | __u64 reserved6; | |
54 | }; | |
55 | ||
a9282d01 | 56 | /* ioctl numbers */ |
66b43081 IM |
57 | #define CXL_MAGIC 0xCA |
58 | #define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work) | |
59 | #define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32) | |
27d4dc71 | 60 | #define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id) |
66b43081 | 61 | |
66b43081 IM |
62 | #define CXL_READ_MIN_SIZE 0x1000 /* 4K */ |
63 | ||
a9282d01 | 64 | /* Events from read() */ |
66b43081 IM |
65 | enum cxl_event_type { |
66 | CXL_EVENT_RESERVED = 0, | |
67 | CXL_EVENT_AFU_INTERRUPT = 1, | |
68 | CXL_EVENT_DATA_STORAGE = 2, | |
69 | CXL_EVENT_AFU_ERROR = 3, | |
70 | }; | |
71 | ||
72 | struct cxl_event_header { | |
73 | __u16 type; | |
74 | __u16 size; | |
75 | __u16 process_element; | |
76 | __u16 reserved1; | |
77 | }; | |
78 | ||
79 | struct cxl_event_afu_interrupt { | |
80 | __u16 flags; | |
81 | __u16 irq; /* Raised AFU interrupt number */ | |
82 | __u32 reserved1; | |
83 | }; | |
84 | ||
85 | struct cxl_event_data_storage { | |
86 | __u16 flags; | |
87 | __u16 reserved1; | |
88 | __u32 reserved2; | |
89 | __u64 addr; | |
90 | __u64 dsisr; | |
91 | __u64 reserved3; | |
92 | }; | |
93 | ||
94 | struct cxl_event_afu_error { | |
95 | __u16 flags; | |
96 | __u16 reserved1; | |
97 | __u32 reserved2; | |
98 | __u64 error; | |
99 | }; | |
100 | ||
101 | struct cxl_event { | |
102 | struct cxl_event_header header; | |
103 | union { | |
104 | struct cxl_event_afu_interrupt irq; | |
105 | struct cxl_event_data_storage fault; | |
106 | struct cxl_event_afu_error afu_error; | |
107 | }; | |
108 | }; | |
109 | ||
110 | #endif /* _UAPI_MISC_CXL_H */ |