blob: a45ab14ccf6dbfbc3072fc509abd893b02e0702c [file] [log] [blame]
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001/****************************************************************************
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 Ferris37c3f3c2023-07-10 10:59:05 -070024#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 Ferrisa9750ed2021-05-03 14:02:49 -070025#define ___C(a,b) CXL_MEM_COMMAND_ID_ ##a
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070026#define ___DEPRECATED(a,b) CXL_MEM_DEPRECATED_ID_ ##a
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070027enum {
28 CXL_CMDS
29};
30#undef ___C
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070031#undef ___DEPRECATED
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070032#define ___C(a,b) { b }
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070033#define ___DEPRECATED(a,b) { "Deprecated " b }
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070034static const struct {
35 const char * name;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070036} cxl_command_names[] __attribute__((__unused__)) = {
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070037 CXL_CMDS
38};
39#undef ___C
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070040#undef ___DEPRECATED
41#define ___C(a,b) (0)
42#define ___DEPRECATED(a,b) (1)
43#undef ___C
44#undef ___DEPRECATED
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070045struct cxl_command_info {
46 __u32 id;
47 __u32 flags;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000048#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 Ferris80ae69d2022-08-02 16:32:21 -070051 __u32 size_in;
52 __u32 size_out;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070053};
54struct cxl_mem_query_commands {
55 __u32 n_commands;
56 __u32 rsvd;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070057 struct cxl_command_info commands[];
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070058};
59struct 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 Ferris80ae69d2022-08-02 16:32:21 -070071 __u32 size;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070072 __u32 rsvd;
73 __u64 payload;
74 } in;
75 struct {
Christopher Ferris80ae69d2022-08-02 16:32:21 -070076 __u32 size;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070077 __u32 rsvd;
78 __u64 payload;
79 } out;
80};
81#endif