linux/drivers/net/mctp/mctp-i3c.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Implements DMTF specification
 * "DSP0233 Management Component Transport Protocol (MCTP) I3C Transport
 * Binding"
 * https://www.dmtf.org/sites/default/files/standards/documents/DSP0233_1.0.0.pdf
 *
 * Copyright (c) 2023 Code Construct
 */

#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/i3c/device.h>
#include <linux/i3c/master.h>
#include <linux/if_arp.h>
#include <linux/unaligned.h>
#include <net/mctp.h>
#include <net/mctpdevice.h>

#define MCTP_I3C_MAXBUF
/* 48 bit Provisioned Id */
#define PID_SIZE

/* 64 byte payload, 4 byte MCTP header */
static const int MCTP_I3C_MINMTU =;
/* One byte less to allow for the PEC */
static const int MCTP_I3C_MAXMTU =;
/* 4 byte MCTP header, no data, 1 byte PEC */
static const int MCTP_I3C_MINLEN =;

/* Sufficient for 64kB at min mtu */
static const int MCTP_I3C_TX_QUEUE_LEN =;

/* Somewhat arbitrary */
static const int MCTP_I3C_IBI_SLOTS =;

/* Mandatory Data Byte in an IBI, from DSP0233 */
#define I3C_MDB_MCTP
/* From MIPI Device Characteristics Register (DCR) Assignments */
#define I3C_DCR_MCTP

static const char *MCTP_I3C_OF_PROP =;

/* List of mctp_i3c_busdev */
static LIST_HEAD(busdevs);
/* Protects busdevs, as well as mctp_i3c_bus.devs lists */
static DEFINE_MUTEX(busdevs_lock);

struct mctp_i3c_bus {};

struct mctp_i3c_device {};

/* We synthesise a mac header using the Provisioned ID.
 * Used to pass dest to mctp_i3c_start_xmit.
 */
struct mctp_i3c_internal_hdr {} __packed;

static int mctp_i3c_read(struct mctp_i3c_device *mi)
{}

static void mctp_i3c_ibi_handler(struct i3c_device *i3c,
				 const struct i3c_ibi_payload *payload)
{}

static int mctp_i3c_setup(struct mctp_i3c_device *mi)
{}

/* Adds a new MCTP i3c_device to a bus */
static int mctp_i3c_add_device(struct mctp_i3c_bus *mbus,
			       struct i3c_device *i3c)
__must_hold(&busdevs_lock)
{}

static int mctp_i3c_probe(struct i3c_device *i3c)
{}

static void mctp_i3c_remove_device(struct mctp_i3c_device *mi)
__must_hold(&busdevs_lock)
{}

static void mctp_i3c_remove(struct i3c_device *i3c)
{}

/* Returns the device for an address, with mi->lock held */
static struct mctp_i3c_device *
mctp_i3c_lookup(struct mctp_i3c_bus *mbus, u64 pid)
{}

static void mctp_i3c_xmit(struct mctp_i3c_bus *mbus, struct sk_buff *skb)
{}

static int mctp_i3c_tx_thread(void *data)
{}

static netdev_tx_t mctp_i3c_start_xmit(struct sk_buff *skb,
				       struct net_device *ndev)
{}

static void mctp_i3c_bus_free(struct mctp_i3c_bus *mbus)
__must_hold(&busdevs_lock)
{}

static void mctp_i3c_ndo_uninit(struct net_device *ndev)
{}

static int mctp_i3c_header_create(struct sk_buff *skb, struct net_device *dev,
				  unsigned short type, const void *daddr,
	   const void *saddr, unsigned int len)
{}

static const struct net_device_ops mctp_i3c_ops =;

static const struct header_ops mctp_i3c_headops =;

static void mctp_i3c_net_setup(struct net_device *dev)
{}

static bool mctp_i3c_is_mctp_controller(struct i3c_bus *bus)
{}

/* Returns the Provisioned Id of a local bus master */
static int mctp_i3c_bus_local_pid(struct i3c_bus *bus, u64 *ret_pid)
{}

/* Returns an ERR_PTR on failure */
static struct mctp_i3c_bus *mctp_i3c_bus_add(struct i3c_bus *bus)
__must_hold(&busdevs_lock)
{}

static void mctp_i3c_bus_remove(struct mctp_i3c_bus *mbus)
__must_hold(&busdevs_lock)
{}

/* Removes all mctp-i3c busses */
static void mctp_i3c_bus_remove_all(void)
{}

/* Adds a i3c_bus if it isn't already in the busdevs list.
 * Suitable as an i3c_for_each_bus_locked callback.
 */
static int mctp_i3c_bus_add_new(struct i3c_bus *bus, void *data)
{}

static void mctp_i3c_notify_bus_remove(struct i3c_bus *bus)
{}

static int mctp_i3c_notifier_call(struct notifier_block *nb,
				  unsigned long action, void *data)
{}

static struct notifier_block mctp_i3c_notifier =;

static const struct i3c_device_id mctp_i3c_ids[] =;

static struct i3c_driver mctp_i3c_driver =;

static __init int mctp_i3c_mod_init(void)
{}

static __exit void mctp_i3c_mod_exit(void)
{}

module_init();
module_exit(mctp_i3c_mod_exit);

MODULE_DEVICE_TABLE(i3c, mctp_i3c_ids);
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_AUTHOR();