linux/drivers/crypto/ccp/ccp-dev-v5.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * AMD Cryptographic Coprocessor (CCP) driver
 *
 * Copyright (C) 2016,2019 Advanced Micro Devices, Inc.
 *
 * Author: Gary R Hook <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/compiler.h>
#include <linux/ccp.h>

#include "ccp-dev.h"

/* Allocate the requested number of contiguous LSB slots
 * from the LSB bitmap. Look in the private range for this
 * queue first; failing that, check the public area.
 * If no space is available, wait around.
 * Return: first slot number
 */
static u32 ccp_lsb_alloc(struct ccp_cmd_queue *cmd_q, unsigned int count)
{}

/* Free a number of LSB slots from the bitmap, starting at
 * the indicated starting slot number.
 */
static void ccp_lsb_free(struct ccp_cmd_queue *cmd_q, unsigned int start,
			 unsigned int count)
{}

/* CCP version 5: Union to define the function field (cmd_reg1/dword0) */
ccp_function;

#define CCP_AES_SIZE(p)
#define CCP_AES_ENCRYPT(p)
#define CCP_AES_MODE(p)
#define CCP_AES_TYPE(p)
#define CCP_XTS_SIZE(p)
#define CCP_XTS_TYPE(p)
#define CCP_XTS_ENCRYPT(p)
#define CCP_DES3_SIZE(p)
#define CCP_DES3_ENCRYPT(p)
#define CCP_DES3_MODE(p)
#define CCP_DES3_TYPE(p)
#define CCP_SHA_TYPE(p)
#define CCP_RSA_SIZE(p)
#define CCP_PT_BYTESWAP(p)
#define CCP_PT_BITWISE(p)
#define CCP_ECC_MODE(p)
#define CCP_ECC_AFFINE(p)

/* Word 0 */
#define CCP5_CMD_DW0(p)
#define CCP5_CMD_SOC(p)
#define CCP5_CMD_IOC(p)
#define CCP5_CMD_INIT(p)
#define CCP5_CMD_EOM(p)
#define CCP5_CMD_FUNCTION(p)
#define CCP5_CMD_ENGINE(p)
#define CCP5_CMD_PROT(p)

/* Word 1 */
#define CCP5_CMD_DW1(p)
#define CCP5_CMD_LEN(p)

/* Word 2 */
#define CCP5_CMD_DW2(p)
#define CCP5_CMD_SRC_LO(p)

/* Word 3 */
#define CCP5_CMD_DW3(p)
#define CCP5_CMD_SRC_MEM(p)
#define CCP5_CMD_SRC_HI(p)
#define CCP5_CMD_LSB_ID(p)
#define CCP5_CMD_FIX_SRC(p)

/* Words 4/5 */
#define CCP5_CMD_DW4(p)
#define CCP5_CMD_DST_LO(p)
#define CCP5_CMD_DW5(p)
#define CCP5_CMD_DST_HI(p)
#define CCP5_CMD_DST_MEM(p)
#define CCP5_CMD_FIX_DST(p)
#define CCP5_CMD_SHA_LO(p)
#define CCP5_CMD_SHA_HI(p)

/* Word 6/7 */
#define CCP5_CMD_DW6(p)
#define CCP5_CMD_KEY_LO(p)
#define CCP5_CMD_DW7(p)
#define CCP5_CMD_KEY_HI(p)
#define CCP5_CMD_KEY_MEM(p)

static inline u32 low_address(unsigned long addr)
{}

static inline u32 high_address(unsigned long addr)
{}

static unsigned int ccp5_get_free_slots(struct ccp_cmd_queue *cmd_q)
{}

static int ccp5_do_cmd(struct ccp5_desc *desc,
		       struct ccp_cmd_queue *cmd_q)
{}

static int ccp5_perform_aes(struct ccp_op *op)
{}

static int ccp5_perform_xts_aes(struct ccp_op *op)
{}

static int ccp5_perform_sha(struct ccp_op *op)
{}

static int ccp5_perform_des3(struct ccp_op *op)
{}

static int ccp5_perform_rsa(struct ccp_op *op)
{}

static int ccp5_perform_passthru(struct ccp_op *op)
{}

static int ccp5_perform_ecc(struct ccp_op *op)
{}

static int ccp_find_lsb_regions(struct ccp_cmd_queue *cmd_q, u64 status)
{}

static int ccp_find_and_assign_lsb_to_q(struct ccp_device *ccp,
					int lsb_cnt, int n_lsbs,
					unsigned long *lsb_pub)
{}

/* For each queue, from the most- to least-constrained:
 * find an LSB that can be assigned to the queue. If there are N queues that
 * can only use M LSBs, where N > M, fail; otherwise, every queue will get a
 * dedicated LSB. Remaining LSB regions become a shared resource.
 * If we have fewer LSBs than queues, all LSB regions become shared resources.
 */
static int ccp_assign_lsbs(struct ccp_device *ccp)
{}

static void ccp5_disable_queue_interrupts(struct ccp_device *ccp)
{}

static void ccp5_enable_queue_interrupts(struct ccp_device *ccp)
{}

static void ccp5_irq_bh(unsigned long data)
{}

static irqreturn_t ccp5_irq_handler(int irq, void *data)
{}

static int ccp5_init(struct ccp_device *ccp)
{}

static void ccp5_destroy(struct ccp_device *ccp)
{}

static void ccp5_config(struct ccp_device *ccp)
{}

static void ccp5other_config(struct ccp_device *ccp)
{}

/* Version 5 adds some function, but is essentially the same as v5 */
static const struct ccp_actions ccp5_actions =;

const struct ccp_vdata ccpv5a =;

const struct ccp_vdata ccpv5b =;