Ian Munsie | 66b4308 | 2014-10-08 19:55:03 +1100 | [diff] [blame] | 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 | |
Ian Munsie | a9282d0 | 2014-10-08 19:55:05 +1100 | [diff] [blame] | 16 | |
Ian Munsie | 66b4308 | 2014-10-08 19:55:03 +1100 | [diff] [blame] | 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 | }; |
Ian Munsie | a9282d0 | 2014-10-08 19:55:05 +1100 | [diff] [blame] | 29 | |
Ian Munsie | 66b4308 | 2014-10-08 19:55:03 +1100 | [diff] [blame] | 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 | |
Ian Munsie | a9282d0 | 2014-10-08 19:55:05 +1100 | [diff] [blame] | 35 | /* ioctl numbers */ |
Ian Munsie | 66b4308 | 2014-10-08 19:55:03 +1100 | [diff] [blame] | 36 | #define CXL_MAGIC 0xCA |
| 37 | #define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work) |
| 38 | #define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32) |
| 39 | |
Ian Munsie | 66b4308 | 2014-10-08 19:55:03 +1100 | [diff] [blame] | 40 | #define CXL_READ_MIN_SIZE 0x1000 /* 4K */ |
| 41 | |
Ian Munsie | a9282d0 | 2014-10-08 19:55:05 +1100 | [diff] [blame] | 42 | /* Events from read() */ |
Ian Munsie | 66b4308 | 2014-10-08 19:55:03 +1100 | [diff] [blame] | 43 | enum cxl_event_type { |
| 44 | CXL_EVENT_RESERVED = 0, |
| 45 | CXL_EVENT_AFU_INTERRUPT = 1, |
| 46 | CXL_EVENT_DATA_STORAGE = 2, |
| 47 | CXL_EVENT_AFU_ERROR = 3, |
| 48 | }; |
| 49 | |
| 50 | struct cxl_event_header { |
| 51 | __u16 type; |
| 52 | __u16 size; |
| 53 | __u16 process_element; |
| 54 | __u16 reserved1; |
| 55 | }; |
| 56 | |
| 57 | struct cxl_event_afu_interrupt { |
| 58 | __u16 flags; |
| 59 | __u16 irq; /* Raised AFU interrupt number */ |
| 60 | __u32 reserved1; |
| 61 | }; |
| 62 | |
| 63 | struct cxl_event_data_storage { |
| 64 | __u16 flags; |
| 65 | __u16 reserved1; |
| 66 | __u32 reserved2; |
| 67 | __u64 addr; |
| 68 | __u64 dsisr; |
| 69 | __u64 reserved3; |
| 70 | }; |
| 71 | |
| 72 | struct cxl_event_afu_error { |
| 73 | __u16 flags; |
| 74 | __u16 reserved1; |
| 75 | __u32 reserved2; |
| 76 | __u64 error; |
| 77 | }; |
| 78 | |
| 79 | struct cxl_event { |
| 80 | struct cxl_event_header header; |
| 81 | union { |
| 82 | struct cxl_event_afu_interrupt irq; |
| 83 | struct cxl_event_data_storage fault; |
| 84 | struct cxl_event_afu_error afu_error; |
| 85 | }; |
| 86 | }; |
| 87 | |
| 88 | #endif /* _UAPI_MISC_CXL_H */ |