linux/drivers/firmware/arm_scpi.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * System Control and Power Interface (SCPI) Message Protocol driver
 *
 * SCPI Message Protocol is used between the System Control Processor(SCP)
 * and the Application Processors(AP). The Message Handling Unit(MHU)
 * provides a mechanism for inter-processor communication between SCP's
 * Cortex M3 and AP.
 *
 * SCP offers control and management of the core/cluster power states,
 * various power domain DVFS including the core/cluster, certain system
 * clocks configuration, thermal sensors and many others.
 *
 * Copyright (C) 2015 ARM Ltd.
 */

#define pr_fmt(fmt)

#include <linux/bitmap.h>
#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/export.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mailbox_client.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/property.h>
#include <linux/pm_opp.h>
#include <linux/scpi_protocol.h>
#include <linux/slab.h>
#include <linux/sort.h>
#include <linux/spinlock.h>

#define CMD_ID_MASK
#define CMD_TOKEN_ID_MASK
#define CMD_DATA_SIZE_MASK
#define CMD_LEGACY_DATA_SIZE_MASK
#define PACK_SCPI_CMD(cmd_id, tx_sz)
#define PACK_LEGACY_SCPI_CMD(cmd_id, tx_sz)

#define CMD_SIZE(cmd)
#define CMD_UNIQ_MASK
#define CMD_XTRACT_UNIQ(cmd)

#define SCPI_SLOT

#define MAX_DVFS_DOMAINS
#define MAX_DVFS_OPPS

#define PROTO_REV_MAJOR_MASK
#define PROTO_REV_MINOR_MASK

#define FW_REV_MAJOR_MASK
#define FW_REV_MINOR_MASK
#define FW_REV_PATCH_MASK

#define MAX_RX_TIMEOUT

enum scpi_error_codes {};

/* SCPI Standard commands */
enum scpi_std_cmd {};

/* SCPI Legacy Commands */
enum legacy_scpi_std_cmd {};

/* List all commands that are required to go through the high priority link */
static int legacy_hpriority_cmds[] =;

/* List all commands used by this driver, used as indexes */
enum scpi_drv_cmds {};

static int scpi_std_commands[CMD_MAX_COUNT] =;

static int scpi_legacy_commands[CMD_MAX_COUNT] =;

struct scpi_xfer {};

struct scpi_chan {};

struct scpi_drvinfo {};

/*
 * The SCP firmware only executes in little-endian mode, so any buffers
 * shared through SCPI should have their contents converted to little-endian
 */
struct scpi_shared_mem {} __packed;

struct legacy_scpi_shared_mem {} __packed;

struct scp_capabilities {} __packed;

struct clk_get_info {} __packed;

struct clk_set_value {} __packed;

struct legacy_clk_set_value {} __packed;

struct dvfs_info {} __packed;

struct dvfs_set {} __packed;

struct _scpi_sensor_info {};

struct dev_pstate_set {} __packed;

static struct scpi_drvinfo *scpi_info;

static int scpi_linux_errmap[SCPI_ERR_MAX] =;

static inline int scpi_to_linux_errno(int errno)
{}

static void scpi_process_cmd(struct scpi_chan *ch, u32 cmd)
{}

static void scpi_handle_remote_msg(struct mbox_client *c, void *msg)
{}

static void scpi_tx_prepare(struct mbox_client *c, void *msg)
{}

static struct scpi_xfer *get_scpi_xfer(struct scpi_chan *ch)
{}

static void put_scpi_xfer(struct scpi_xfer *t, struct scpi_chan *ch)
{}

static int scpi_send_message(u8 idx, void *tx_buf, unsigned int tx_len,
			     void *rx_buf, unsigned int rx_len)
{}

static u32 scpi_get_version(void)
{}

static int
scpi_clk_get_range(u16 clk_id, unsigned long *min, unsigned long *max)
{}

static unsigned long scpi_clk_get_val(u16 clk_id)
{}

static int scpi_clk_set_val(u16 clk_id, unsigned long rate)
{}

static int legacy_scpi_clk_set_val(u16 clk_id, unsigned long rate)
{}

static int scpi_dvfs_get_idx(u8 domain)
{}

static int scpi_dvfs_set_idx(u8 domain, u8 index)
{}

static int opp_cmp_func(const void *opp1, const void *opp2)
{}

static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain)
{}

static int scpi_dev_domain_id(struct device *dev)
{}

static struct scpi_dvfs_info *scpi_dvfs_info(struct device *dev)
{}

static int scpi_dvfs_get_transition_latency(struct device *dev)
{}

static int scpi_dvfs_add_opps_to_device(struct device *dev)
{}

static int scpi_sensor_get_capability(u16 *sensors)
{}

static int scpi_sensor_get_info(u16 sensor_id, struct scpi_sensor_info *info)
{}

static int scpi_sensor_get_value(u16 sensor, u64 *val)
{}

static int scpi_device_get_power_state(u16 dev_id)
{}

static int scpi_device_set_power_state(u16 dev_id, u8 pstate)
{}

static struct scpi_ops scpi_ops =;

struct scpi_ops *get_scpi_ops(void)
{}
EXPORT_SYMBOL_GPL();

static int scpi_init_versions(struct scpi_drvinfo *info)
{}

static ssize_t protocol_version_show(struct device *dev,
				     struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(protocol_version);

static ssize_t firmware_version_show(struct device *dev,
				     struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(firmware_version);

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

static void scpi_free_channels(void *data)
{}

static void scpi_remove(struct platform_device *pdev)
{}

#define MAX_SCPI_XFERS
static int scpi_alloc_xfer_list(struct device *dev, struct scpi_chan *ch)
{}

static const struct of_device_id shmem_of_match[] __maybe_unused =;

static int scpi_probe(struct platform_device *pdev)
{}

static const struct of_device_id scpi_of_match[] =;

MODULE_DEVICE_TABLE(of, scpi_of_match);

static struct platform_driver scpi_driver =;
module_platform_driver();

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