1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 2/*
 3 * Copyright (c) 2024-2025 Intel Corporation
 4 *
 5 * These are definitions for the mailbox command interface of CXL subsystem.
 6 */
 7#ifndef _FWCTL_CXL_H_
 8#define _FWCTL_CXL_H_
 9
10#include <linux/types.h>
11#include <linux/stddef.h>
12#include <cxl/features.h>
13
14/**
15 * struct fwctl_rpc_cxl - ioctl(FWCTL_RPC) input for CXL
16 * @opcode: CXL mailbox command opcode
17 * @flags: Flags for the command (input).
18 * @op_size: Size of input payload.
19 * @reserved1: Reserved. Must be 0s.
20 * @get_sup_feats_in: Get Supported Features input
21 * @get_feat_in: Get Feature input
22 * @set_feat_in: Set Feature input
23 */
24struct fwctl_rpc_cxl {
25	__struct_group(fwctl_rpc_cxl_hdr, hdr, /* no attrs */,
26		__u32 opcode;
27		__u32 flags;
28		__u32 op_size;
29		__u32 reserved1;
30	);
31	union {
32		struct cxl_mbox_get_sup_feats_in get_sup_feats_in;
33		struct cxl_mbox_get_feat_in get_feat_in;
34		struct cxl_mbox_set_feat_in set_feat_in;
35	};
36};
37
38/**
39 * struct fwctl_rpc_cxl_out - ioctl(FWCTL_RPC) output for CXL
40 * @size: Size of the output payload
41 * @retval: Return value from device
42 * @get_sup_feats_out: Get Supported Features output
43 * @payload: raw byte stream of payload
44 */
45struct fwctl_rpc_cxl_out {
46	__struct_group(fwctl_rpc_cxl_out_hdr, hdr, /* no attrs */,
47		__u32 size;
48		__u32 retval;
49	);
50	union {
51		struct cxl_mbox_get_sup_feats_out get_sup_feats_out;
52		__DECLARE_FLEX_ARRAY(__u8, payload);
53	};
54};
55
56#endif