linux/drivers/fsi/fsi-sbefifo.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) IBM Corporation 2017
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERGCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/device.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/fsi.h>
#include <linux/fsi-sbefifo.h>
#include <linux/kernel.h>
#include <linux/cdev.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/delay.h>
#include <linux/uio.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>

#include <uapi/linux/fsi.h>

/*
 * The SBEFIFO is a pipe-like FSI device for communicating with
 * the self boot engine on POWER processors.
 */

#define DEVICE_NAME
#define FSI_ENGID_SBE

/*
 * Register layout
 */

/* Register banks */
#define SBEFIFO_UP
#define SBEFIFO_DOWN

/* Per-bank registers */
#define SBEFIFO_FIFO
#define SBEFIFO_STS
#define SBEFIFO_STS_PARITY_ERR
#define SBEFIFO_STS_RESET_REQ
#define SBEFIFO_STS_GOT_EOT
#define SBEFIFO_STS_MAX_XFER_LIMIT
#define SBEFIFO_STS_FULL
#define SBEFIFO_STS_EMPTY
#define SBEFIFO_STS_ECNT_MASK
#define SBEFIFO_STS_ECNT_SHIFT
#define SBEFIFO_STS_VALID_MASK
#define SBEFIFO_STS_VALID_SHIFT
#define SBEFIFO_STS_EOT_MASK
#define SBEFIFO_STS_EOT_SHIFT
#define SBEFIFO_EOT_RAISE
#define SBEFIFO_REQ_RESET
#define SBEFIFO_PERFORM_RESET
#define SBEFIFO_EOT_ACK
#define SBEFIFO_DOWN_MAX

/* CFAM GP Mailbox SelfBoot Message register */
#define CFAM_GP_MBOX_SBM_ADDR

#define CFAM_SBM_SBE_BOOTED
#define CFAM_SBM_SBE_ASYNC_FFDC
#define CFAM_SBM_SBE_STATE_MASK
#define CFAM_SBM_SBE_STATE_SHIFT

enum sbe_state
{};

/* FIFO depth */
#define SBEFIFO_FIFO_DEPTH

/* Helpers */
#define sbefifo_empty(sts)
#define sbefifo_full(sts)
#define sbefifo_parity_err(sts)
#define sbefifo_populated(sts)
#define sbefifo_vacant(sts)
#define sbefifo_eot_set(sts)

/* Reset request timeout in ms */
#define SBEFIFO_RESET_TIMEOUT

/* Timeouts for commands in ms */
#define SBEFIFO_TIMEOUT_START_CMD
#define SBEFIFO_TIMEOUT_IN_CMD
#define SBEFIFO_TIMEOUT_START_RSP
#define SBEFIFO_TIMEOUT_IN_RSP

/* Other constants */
#define SBEFIFO_MAX_USER_CMD_LEN
#define SBEFIFO_RESET_MAGIC

struct sbefifo {};

struct sbefifo_user {};

static DEFINE_MUTEX(sbefifo_ffdc_mutex);

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

static void __sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
				size_t ffdc_sz, bool internal)
{}

static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
			      size_t ffdc_sz, bool internal)
{}

int sbefifo_parse_status(struct device *dev, u16 cmd, __be32 *response,
			 size_t resp_len, size_t *data_len)
{}
EXPORT_SYMBOL_GPL();

static int sbefifo_regr(struct sbefifo *sbefifo, int reg, u32 *word)
{}

static int sbefifo_regw(struct sbefifo *sbefifo, int reg, u32 word)
{}

static int sbefifo_check_sbe_state(struct sbefifo *sbefifo)
{}

/* Don't flip endianness of data to/from FIFO, just pass through. */
static int sbefifo_down_read(struct sbefifo *sbefifo, __be32 *word)
{}

static int sbefifo_up_write(struct sbefifo *sbefifo, __be32 word)
{}

static int sbefifo_request_reset(struct sbefifo *sbefifo)
{}

static int sbefifo_cleanup_hw(struct sbefifo *sbefifo)
{}

static int sbefifo_wait(struct sbefifo *sbefifo, bool up,
			u32 *status, unsigned long timeout)
{}

static int sbefifo_send_command(struct sbefifo *sbefifo,
				const __be32 *command, size_t cmd_len)
{}

static int sbefifo_read_response(struct sbefifo *sbefifo, struct iov_iter *response)
{}

static int sbefifo_do_command(struct sbefifo *sbefifo,
			      const __be32 *command, size_t cmd_len,
			      struct iov_iter *response)
{}

static void sbefifo_collect_async_ffdc(struct sbefifo *sbefifo)
{}

static int __sbefifo_submit(struct sbefifo *sbefifo,
			    const __be32 *command, size_t cmd_len,
			    struct iov_iter *response)
{}

/**
 * sbefifo_submit() - Submit and SBE fifo command and receive response
 * @dev: The sbefifo device
 * @command: The raw command data
 * @cmd_len: The command size (in 32-bit words)
 * @response: The output response buffer
 * @resp_len: In: Response buffer size, Out: Response size
 *
 * This will perform the entire operation. If the response buffer
 * overflows, returns -EOVERFLOW
 */
int sbefifo_submit(struct device *dev, const __be32 *command, size_t cmd_len,
		   __be32 *response, size_t *resp_len)
{}
EXPORT_SYMBOL_GPL();

/*
 * Char device interface
 */

static void sbefifo_release_command(struct sbefifo_user *user)
{}

static int sbefifo_user_open(struct inode *inode, struct file *file)
{}

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

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

static int sbefifo_user_release(struct inode *inode, struct file *file)
{}

static int sbefifo_cmd_timeout(struct sbefifo_user *user, void __user *argp)
{}

static int sbefifo_read_timeout(struct sbefifo_user *user, void __user *argp)
{}

static long sbefifo_user_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{}

static const struct file_operations sbefifo_fops =;

static void sbefifo_free(struct device *dev)
{}

/*
 * Probe/remove
 */

static int sbefifo_probe(struct device *dev)
{}

static int sbefifo_unregister_child(struct device *dev, void *data)
{}

static int sbefifo_remove(struct device *dev)
{}

static const struct fsi_device_id sbefifo_ids[] =;

static struct fsi_driver sbefifo_drv =;

static int sbefifo_init(void)
{}

static void sbefifo_exit(void)
{}

module_init();
module_exit(sbefifo_exit);
MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();