blob: 5a0a34ef2116d1d9fad9e41dd9f3d09d953e40d8 [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 Ferris3a39c0b2021-09-02 00:03:38 +000024#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"), ___C(GET_POISON, "Get Poison List"), ___C(INJECT_POISON, "Inject Poison"), ___C(CLEAR_POISON, "Clear Poison"), ___C(GET_SCAN_MEDIA_CAPS, "Get Scan Media Capabilities"), ___C(SCAN_MEDIA, "Scan Media"), ___C(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
26enum {
27 CXL_CMDS
28};
29#undef ___C
30#define ___C(a,b) { b }
31static const struct {
32 const char * name;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070033} cxl_command_names[] __attribute__((__unused__)) = {
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070034 CXL_CMDS
35};
36#undef ___C
37struct cxl_command_info {
38 __u32 id;
39 __u32 flags;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000040#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(1, 0)
41#define CXL_MEM_COMMAND_FLAG_ENABLED BIT(0)
42#define CXL_MEM_COMMAND_FLAG_EXCLUSIVE BIT(1)
Christopher Ferris80ae69d2022-08-02 16:32:21 -070043 __u32 size_in;
44 __u32 size_out;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070045};
46struct cxl_mem_query_commands {
47 __u32 n_commands;
48 __u32 rsvd;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070049 struct cxl_command_info commands[];
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070050};
51struct cxl_send_command {
52 __u32 id;
53 __u32 flags;
54 union {
55 struct {
56 __u16 opcode;
57 __u16 rsvd;
58 } raw;
59 __u32 rsvd;
60 };
61 __u32 retval;
62 struct {
Christopher Ferris80ae69d2022-08-02 16:32:21 -070063 __u32 size;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070064 __u32 rsvd;
65 __u64 payload;
66 } in;
67 struct {
Christopher Ferris80ae69d2022-08-02 16:32:21 -070068 __u32 size;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070069 __u32 rsvd;
70 __u64 payload;
71 } out;
72};
73#endif