blob: abe6573c957a108ec2a703e7beaf041bda260cbe [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07007#ifndef _UAPI_CXL_MEM_H_
8#define _UAPI_CXL_MEM_H_
9#include <linux/types.h>
10#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
11#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
Christopher Ferris7ac54f52024-08-07 21:07:12 +000012#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(GET_TIMESTAMP, "Get Timestamp"), ___C(GET_LOG_CAPS, "Get Log Capabilities"), ___C(CLEAR_LOG, "Clear Log"), ___C(GET_SUP_LOG_SUBLIST, "Get Supported Logs Sub-List"), ___C(MAX, "invalid / last command")
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070013#define ___C(a,b) CXL_MEM_COMMAND_ID_ ##a
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070014#define ___DEPRECATED(a,b) CXL_MEM_DEPRECATED_ID_ ##a
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070015enum {
16 CXL_CMDS
17};
18#undef ___C
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070019#undef ___DEPRECATED
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070020#define ___C(a,b) { b }
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070021#define ___DEPRECATED(a,b) { "Deprecated " b }
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070022static const struct {
23 const char * name;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070024} cxl_command_names[] __attribute__((__unused__)) = {
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070025 CXL_CMDS
26};
27#undef ___C
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070028#undef ___DEPRECATED
29#define ___C(a,b) (0)
30#define ___DEPRECATED(a,b) (1)
31#undef ___C
32#undef ___DEPRECATED
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070033struct cxl_command_info {
34 __u32 id;
35 __u32 flags;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000036#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(1, 0)
37#define CXL_MEM_COMMAND_FLAG_ENABLED BIT(0)
38#define CXL_MEM_COMMAND_FLAG_EXCLUSIVE BIT(1)
Christopher Ferris80ae69d2022-08-02 16:32:21 -070039 __u32 size_in;
40 __u32 size_out;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070041};
42struct cxl_mem_query_commands {
43 __u32 n_commands;
44 __u32 rsvd;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070045 struct cxl_command_info commands[];
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070046};
47struct cxl_send_command {
48 __u32 id;
49 __u32 flags;
50 union {
51 struct {
52 __u16 opcode;
53 __u16 rsvd;
54 } raw;
55 __u32 rsvd;
56 };
57 __u32 retval;
58 struct {
Christopher Ferris80ae69d2022-08-02 16:32:21 -070059 __u32 size;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070060 __u32 rsvd;
61 __u64 payload;
62 } in;
63 struct {
Christopher Ferris80ae69d2022-08-02 16:32:21 -070064 __u32 size;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070065 __u32 rsvd;
66 __u64 payload;
67 } out;
68};
69#endif