diff options
author | Oleksandr Shulzhenko <oleksandr.shulzhenko.viktorovych@intel.com> | 2022-05-10 18:27:02 +0300 |
---|---|---|
committer | Oleksandr Shulzhenko <oleksandr.shulzhenko.viktorovych@intel.com> | 2022-06-01 11:46:09 +0300 |
commit | 426a368a8790b0561ef81bbd076fcc9c5e7e5ac1 (patch) | |
tree | 3dd348a287933ce8e2014dc584af90fc877421ea /include | |
parent | 1dbcc6ae7d8642d7835bf6a411060e0b9677c905 (diff) | |
download | linux-426a368a8790b0561ef81bbd076fcc9c5e7e5ac1.tar.xz |
i3c: mctp: Extend MCTP o. I3C driver with the TX/RX functions
Extend the driver with the functionality necessary to send
and receive MCTP over I3C packets by another component in kernel:
- i3c_mctp_client concept needed to implement packet queue so that
the driver can manage and classify packets for several clients
respectively;
- the function that provides MCTP target EID;
- the functions to alloc and free mctp_i3c_packet;
- the functions to send and receive MCTP packets over I3C.
Signed-off-by: Oleksandr Shulzhenko <oleksandr.shulzhenko.viktorovych@intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/i3c/mctp/i3c-mctp.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/i3c/mctp/i3c-mctp.h b/include/linux/i3c/mctp/i3c-mctp.h new file mode 100644 index 000000000000..72f6fae922b5 --- /dev/null +++ b/include/linux/i3c/mctp/i3c-mctp.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2022 Intel Corporation.*/ + +#ifndef I3C_MCTP_H +#define I3C_MCTP_H + +#define I3C_MCTP_PACKET_SIZE 68 +#define I3C_MCTP_PAYLOAD_SIZE 64 +#define I3C_MCTP_HDR_SIZE 4 + +struct i3c_mctp_client; + +struct mctp_protocol_hdr { + u8 ver; + u8 dest; + u8 src; + u8 flags_seq_tag; +} __packed; + +struct i3c_mctp_packet_data { + u8 protocol_hdr[I3C_MCTP_HDR_SIZE]; + u8 payload[I3C_MCTP_PAYLOAD_SIZE]; +}; + +struct i3c_mctp_packet { + struct i3c_mctp_packet_data data; + u32 size; +}; + +void *i3c_mctp_packet_alloc(gfp_t flags); +void i3c_mctp_packet_free(void *packet); + +int i3c_mctp_get_eid(struct i3c_mctp_client *client, u8 domain_id, u8 *eid); +int i3c_mctp_send_packet(struct i3c_device *i3c, struct i3c_mctp_packet *tx_packet); +struct i3c_mctp_packet *i3c_mctp_receive_packet(struct i3c_mctp_client *client, + unsigned long timeout); + +#endif /* I3C_MCTP_H */ |