Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 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_CXL_MEM_H_ |
| 20 | #define _UAPI_CXL_MEM_H_ |
| 21 | #include <linux/types.h> |
| 22 | #define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands) |
| 23 | #define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command) |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 24 | #define CXL_CMDS ___C(INVALID, "Invalid Command"), ___C(IDENTIFY, "Identify Command"), ___C(RAW, "Raw device command"), ___C(GET_SUPPORTED_LOGS, "Get Supported Logs"), ___C(GET_FW_INFO, "Get FW Info"), ___C(GET_PARTITION_INFO, "Get Partition Information"), ___C(GET_LSA, "Get Label Storage Area"), ___C(GET_HEALTH_INFO, "Get Health Info"), ___C(GET_LOG, "Get Log"), ___C(SET_PARTITION_INFO, "Set Partition Information"), ___C(SET_LSA, "Set Label Storage Area"), ___C(GET_ALERT_CONFIG, "Get Alert Configuration"), ___C(SET_ALERT_CONFIG, "Set Alert Configuration"), ___C(GET_SHUTDOWN_STATE, "Get Shutdown State"), ___C(SET_SHUTDOWN_STATE, "Set Shutdown State"), ___DEPRECATED(GET_POISON, "Get Poison List"), ___DEPRECATED(INJECT_POISON, "Inject Poison"), ___DEPRECATED(CLEAR_POISON, "Clear Poison"), ___C(GET_SCAN_MEDIA_CAPS, "Get Scan Media Capabilities"), ___DEPRECATED(SCAN_MEDIA, "Scan Media"), ___DEPRECATED(GET_SCAN_MEDIA, "Get Scan Media Results"), ___C(MAX, "invalid / last command") |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 25 | #define ___C(a,b) CXL_MEM_COMMAND_ID_ ##a |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 26 | #define ___DEPRECATED(a,b) CXL_MEM_DEPRECATED_ID_ ##a |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 27 | enum { |
| 28 | CXL_CMDS |
| 29 | }; |
| 30 | #undef ___C |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 31 | #undef ___DEPRECATED |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 32 | #define ___C(a,b) { b } |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 33 | #define ___DEPRECATED(a,b) { "Deprecated " b } |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 34 | static const struct { |
| 35 | const char * name; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 36 | } cxl_command_names[] __attribute__((__unused__)) = { |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 37 | CXL_CMDS |
| 38 | }; |
| 39 | #undef ___C |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 40 | #undef ___DEPRECATED |
| 41 | #define ___C(a,b) (0) |
| 42 | #define ___DEPRECATED(a,b) (1) |
| 43 | #undef ___C |
| 44 | #undef ___DEPRECATED |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 45 | struct cxl_command_info { |
| 46 | __u32 id; |
| 47 | __u32 flags; |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 48 | #define CXL_MEM_COMMAND_FLAG_MASK GENMASK(1, 0) |
| 49 | #define CXL_MEM_COMMAND_FLAG_ENABLED BIT(0) |
| 50 | #define CXL_MEM_COMMAND_FLAG_EXCLUSIVE BIT(1) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 51 | __u32 size_in; |
| 52 | __u32 size_out; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 53 | }; |
| 54 | struct cxl_mem_query_commands { |
| 55 | __u32 n_commands; |
| 56 | __u32 rsvd; |
Elliott Hughes | 0f0c18f | 2023-03-29 15:53:31 -0700 | [diff] [blame] | 57 | struct cxl_command_info commands[]; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 58 | }; |
| 59 | struct cxl_send_command { |
| 60 | __u32 id; |
| 61 | __u32 flags; |
| 62 | union { |
| 63 | struct { |
| 64 | __u16 opcode; |
| 65 | __u16 rsvd; |
| 66 | } raw; |
| 67 | __u32 rsvd; |
| 68 | }; |
| 69 | __u32 retval; |
| 70 | struct { |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 71 | __u32 size; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 72 | __u32 rsvd; |
| 73 | __u64 payload; |
| 74 | } in; |
| 75 | struct { |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 76 | __u32 size; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 77 | __u32 rsvd; |
| 78 | __u64 payload; |
| 79 | } out; |
| 80 | }; |
| 81 | #endif |