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)
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(MAX, "invalid / last command")
25 #define ___C(a,b) CXL_MEM_COMMAND_ID_ ##a
26 enum {
27   CXL_CMDS
28 };
29 #undef ___C
30 #define ___C(a,b) { b }
31 static const struct {
32   const char * name;
33 } cxl_command_names[] = {
34   CXL_CMDS
35 };
36 #undef ___C
37 struct cxl_command_info {
38   __u32 id;
39   __u32 flags;
40 #define CXL_MEM_COMMAND_FLAG_MASK GENMASK(0, 0)
41   __s32 size_in;
42   __s32 size_out;
43 };
44 struct cxl_mem_query_commands {
45   __u32 n_commands;
46   __u32 rsvd;
47   struct cxl_command_info __user commands[];
48 };
49 struct cxl_send_command {
50   __u32 id;
51   __u32 flags;
52   union {
53     struct {
54       __u16 opcode;
55       __u16 rsvd;
56     } raw;
57     __u32 rsvd;
58   };
59   __u32 retval;
60   struct {
61     __s32 size;
62     __u32 rsvd;
63     __u64 payload;
64   } in;
65   struct {
66     __s32 size;
67     __u32 rsvd;
68     __u64 payload;
69   } out;
70 };
71 #endif
72