linux/drivers/firmware/turris-mox-rwtm.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Turris Mox rWTM firmware driver
 *
 * Copyright (C) 2019, 2024 Marek Behún <[email protected]>
 */

#include <crypto/sha2.h>
#include <linux/align.h>
#include <linux/armada-37xx-rwtm-mailbox.h>
#include <linux/completion.h>
#include <linux/container_of.h>
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/fs.h>
#include <linux/hw_random.h>
#include <linux/if_ether.h>
#include <linux/kobject.h>
#include <linux/mailbox_client.h>
#include <linux/minmax.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/sizes.h>
#include <linux/sysfs.h>
#include <linux/types.h>

#define DRIVER_NAME

#define RWTM_DMA_BUFFER_SIZE

/*
 * The macros and constants below come from Turris Mox's rWTM firmware code.
 * This firmware is open source and it's sources can be found at
 * https://gitlab.labs.nic.cz/turris/mox-boot-builder/tree/master/wtmi.
 */

#define MOX_ECC_NUMBER_WORDS
#define MOX_ECC_NUMBER_LEN

#define MOX_ECC_SIGNATURE_WORDS

#define MBOX_STS_SUCCESS
#define MBOX_STS_FAIL
#define MBOX_STS_BADCMD
#define MBOX_STS_ERROR(s)
#define MBOX_STS_VALUE(s)
#define MBOX_STS_CMD(s)

enum mbox_cmd {};

struct mox_rwtm {};

static inline struct device *rwtm_dev(struct mox_rwtm *rwtm)
{}

#define MOX_ATTR_RO(name, format, cat)

MOX_ATTR_RO();
MOX_ATTR_RO();
MOX_ATTR_RO();
MOX_ATTR_RO();
MOX_ATTR_RO();
MOX_ATTR_RO();

static struct attribute *turris_mox_rwtm_attrs[] =;
ATTRIBUTE_GROUPS();

static int mox_get_status(enum mbox_cmd cmd, u32 retval)
{}

static void mox_rwtm_rx_callback(struct mbox_client *cl, void *data)
{}

static int mox_rwtm_exec(struct mox_rwtm *rwtm, enum mbox_cmd cmd,
			 struct armada_37xx_rwtm_tx_msg *msg,
			 bool interruptible)
{}

static void reply_to_mac_addr(u8 *mac, u32 t1, u32 t2)
{}

static int mox_get_board_info(struct mox_rwtm *rwtm)
{}

static int check_get_random_support(struct mox_rwtm *rwtm)
{}

static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait)
{}

#ifdef CONFIG_DEBUG_FS
static int rwtm_debug_open(struct inode *inode, struct file *file)
{}

static ssize_t do_sign_read(struct file *file, char __user *buf, size_t len,
			    loff_t *ppos)
{}

static ssize_t do_sign_write(struct file *file, const char __user *buf,
			     size_t len, loff_t *ppos)
{}

static const struct file_operations do_sign_fops =;

static void rwtm_debugfs_release(void *root)
{}

static void rwtm_register_debugfs(struct mox_rwtm *rwtm)
{}
#else
static inline void rwtm_register_debugfs(struct mox_rwtm *rwtm)
{
}
#endif

static void rwtm_devm_mbox_release(void *mbox)
{}

static void rwtm_firmware_symlink_drop(void *parent)
{}

static int turris_mox_rwtm_probe(struct platform_device *pdev)
{}

static const struct of_device_id turris_mox_rwtm_match[] =;

MODULE_DEVICE_TABLE(of, turris_mox_rwtm_match);

static struct platform_driver turris_mox_rwtm_driver =;
module_platform_driver();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_AUTHOR();