linux/drivers/platform/x86/intel/sdsi.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Intel On Demand (Software Defined Silicon) driver
 *
 * Copyright (c) 2022, Intel Corporation.
 * All Rights Reserved.
 *
 * Author: "David E. Box" <[email protected]>
 */

#include <linux/auxiliary_bus.h>
#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/intel_vsec.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/overflow.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/uaccess.h>

#define ACCESS_TYPE_BARID
#define ACCESS_TYPE_LOCAL

#define SDSI_MIN_SIZE_DWORDS
#define SDSI_SIZE_MAILBOX
#define SDSI_SIZE_REGS
#define SDSI_SIZE_CMD

/*
 * Write messages are currently up to the size of the mailbox
 * while read messages are up to 4 times the size of the
 * mailbox, sent in packets
 */
#define SDSI_SIZE_WRITE_MSG
#define SDSI_SIZE_READ_MSG

#define SDSI_ENABLED_FEATURES_OFFSET
#define SDSI_FEATURE_SDSI
#define SDSI_FEATURE_METERING

#define SDSI_SOCKET_ID_OFFSET
#define SDSI_SOCKET_ID

#define SDSI_MBOX_CMD_SUCCESS
#define SDSI_MBOX_CMD_TIMEOUT

#define MBOX_TIMEOUT_US
#define MBOX_TIMEOUT_ACQUIRE_US
#define MBOX_POLLING_PERIOD_US
#define MBOX_ACQUIRE_NUM_RETRIES
#define MBOX_ACQUIRE_RETRY_DELAY_MS
#define MBOX_MAX_PACKETS

#define MBOX_OWNER_NONE
#define MBOX_OWNER_INBAND

#define CTRL_RUN_BUSY
#define CTRL_READ_WRITE
#define CTRL_SOM
#define CTRL_EOM
#define CTRL_OWNER
#define CTRL_COMPLETE
#define CTRL_READY
#define CTRL_INBAND_LOCK
#define CTRL_METER_ENABLE_DRAM
#define CTRL_STATUS
#define CTRL_PACKET_SIZE
#define CTRL_MSG_SIZE

#define DISC_TABLE_SIZE
#define DT_ACCESS_TYPE
#define DT_SIZE
#define DT_TBIR
#define DT_OFFSET(v)

#define SDSI_GUID_V1
#define GUID_V1_CNTRL_SIZE
#define GUID_V1_REGS_SIZE
#define SDSI_GUID_V2
#define GUID_V2_CNTRL_SIZE
#define GUID_V2_REGS_SIZE

enum sdsi_command {};

struct sdsi_mbox_info {};

struct disc_table {};

struct sdsi_priv {};

/* SDSi mailbox operations must be performed using 64bit mov instructions */
static __always_inline void
sdsi_memcpy64_toio(u64 __iomem *to, const u64 *from, size_t count_bytes)
{}

static __always_inline void
sdsi_memcpy64_fromio(u64 *to, const u64 __iomem *from, size_t count_bytes)
{}

static inline void sdsi_complete_transaction(struct sdsi_priv *priv)
{}

static int sdsi_status_to_errno(u32 status)
{}

static int sdsi_mbox_poll(struct sdsi_priv *priv, struct sdsi_mbox_info *info,
			  size_t *data_size)
{}

static int sdsi_mbox_cmd_read(struct sdsi_priv *priv, struct sdsi_mbox_info *info,
			      size_t *data_size)
{}

static int sdsi_mbox_cmd_write(struct sdsi_priv *priv, struct sdsi_mbox_info *info,
			       size_t *data_size)
{}

static int sdsi_mbox_acquire(struct sdsi_priv *priv, struct sdsi_mbox_info *info)
{}

static int sdsi_mbox_write(struct sdsi_priv *priv, struct sdsi_mbox_info *info,
			   size_t *data_size)
{}

static int sdsi_mbox_read(struct sdsi_priv *priv, struct sdsi_mbox_info *info, size_t *data_size)
{}

static bool sdsi_ib_locked(struct sdsi_priv *priv)
{}

static ssize_t sdsi_provision(struct sdsi_priv *priv, char *buf, size_t count,
			      enum sdsi_command command)
{}

static ssize_t provision_akc_write(struct file *filp, struct kobject *kobj,
				   struct bin_attribute *attr, char *buf, loff_t off,
				   size_t count)
{}
static BIN_ATTR_WO(provision_akc, SDSI_SIZE_WRITE_MSG);

static ssize_t provision_cap_write(struct file *filp, struct kobject *kobj,
				   struct bin_attribute *attr, char *buf, loff_t off,
				   size_t count)
{}
static BIN_ATTR_WO(provision_cap, SDSI_SIZE_WRITE_MSG);

static ssize_t
certificate_read(u64 command, u64 control_flags, struct sdsi_priv *priv,
		 char *buf, loff_t off, size_t count)
{}

static ssize_t
state_certificate_read(struct file *filp, struct kobject *kobj,
		       struct bin_attribute *attr, char *buf, loff_t off,
		       size_t count)
{}
static BIN_ATTR_ADMIN_RO(state_certificate, SDSI_SIZE_READ_MSG);

static ssize_t
meter_certificate_read(struct file *filp, struct kobject *kobj,
		       struct bin_attribute *attr, char *buf, loff_t off,
		       size_t count)
{}
static BIN_ATTR_ADMIN_RO(meter_certificate, SDSI_SIZE_READ_MSG);

static ssize_t
meter_current_read(struct file *filp, struct kobject *kobj,
		   struct bin_attribute *attr, char *buf, loff_t off,
		   size_t count)
{}
static BIN_ATTR_ADMIN_RO(meter_current, SDSI_SIZE_READ_MSG);

static ssize_t registers_read(struct file *filp, struct kobject *kobj,
			      struct bin_attribute *attr, char *buf, loff_t off,
			      size_t count)
{}
static BIN_ATTR_ADMIN_RO(registers, SDSI_SIZE_REGS);

static struct bin_attribute *sdsi_bin_attrs[] =;

static umode_t
sdsi_battr_is_visible(struct kobject *kobj, struct bin_attribute *attr, int n)
{}

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

static struct attribute *sdsi_attrs[] =;

static const struct attribute_group sdsi_group =;
__ATTRIBUTE_GROUPS();

static int sdsi_get_layout(struct sdsi_priv *priv, struct disc_table *table)
{}

static int sdsi_map_mbox_registers(struct sdsi_priv *priv, struct pci_dev *parent,
				   struct disc_table *disc_table, struct resource *disc_res)
{}

static int sdsi_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id)
{}

static const struct auxiliary_device_id sdsi_aux_id_table[] =;
MODULE_DEVICE_TABLE(auxiliary, sdsi_aux_id_table);

static struct auxiliary_driver sdsi_aux_driver =;
module_auxiliary_driver();

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