linux/drivers/crypto/caam/intern.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * CAAM/SEC 4.x driver backend
 * Private/internal definitions between modules
 *
 * Copyright 2008-2011 Freescale Semiconductor, Inc.
 * Copyright 2019, 2023 NXP
 */

#ifndef INTERN_H
#define INTERN_H

#include "ctrl.h"
#include <crypto/engine.h>

/* Currently comes from Kconfig param as a ^2 (driver-required) */
#define JOBR_DEPTH

/*
 * Maximum size for crypto-engine software queue based on Job Ring
 * size (JOBR_DEPTH) and a THRESHOLD (reserved for the non-crypto-API
 * requests that are not passed through crypto-engine)
 */
#define THRESHOLD
#define CRYPTO_ENGINE_MAX_QLEN

/* Kconfig params for interrupt coalescing if selected (else zero) */
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_INTC
#define JOBR_INTC
#define JOBR_INTC_TIME_THLD
#define JOBR_INTC_COUNT_THLD
#else
#define JOBR_INTC
#define JOBR_INTC_TIME_THLD
#define JOBR_INTC_COUNT_THLD
#endif

/*
 * Storage for tracking each in-process entry moving across a ring
 * Each entry on an output ring needs one of these
 */
struct caam_jrentry_info {};

struct caam_jr_state {};

struct caam_jr_dequeue_params {};

/* Private sub-storage for a single JobR */
struct caam_drv_private_jr {};

struct caam_ctl_state {};

/*
 * Driver-private storage for a single CAAM block instance
 */
struct caam_drv_private {};

#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API

int caam_algapi_init(struct device *dev);
void caam_algapi_exit(void);

#else

static inline int caam_algapi_init(struct device *dev)
{
	return 0;
}

static inline void caam_algapi_exit(void)
{
}

#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API */

#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API

int caam_algapi_hash_init(struct device *dev);
void caam_algapi_hash_exit(void);

#else

static inline int caam_algapi_hash_init(struct device *dev)
{
	return 0;
}

static inline void caam_algapi_hash_exit(void)
{
}

#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API */

#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API

int caam_pkc_init(struct device *dev);
void caam_pkc_exit(void);

#else

static inline int caam_pkc_init(struct device *dev)
{
	return 0;
}

static inline void caam_pkc_exit(void)
{
}

#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API */

#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API

int caam_rng_init(struct device *dev);
void caam_rng_exit(struct device *dev);

#else

static inline int caam_rng_init(struct device *dev)
{
	return 0;
}

static inline void caam_rng_exit(struct device *dev) {}

#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API */

#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_PRNG_API

int caam_prng_register(struct device *dev);
void caam_prng_unregister(void *data);

#else

static inline int caam_prng_register(struct device *dev)
{
	return 0;
}

static inline void caam_prng_unregister(void *data) {}
#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_PRNG_API */

#ifdef CONFIG_CAAM_QI

int caam_qi_algapi_init(struct device *dev);
void caam_qi_algapi_exit(void);

#else

static inline int caam_qi_algapi_init(struct device *dev)
{
	return 0;
}

static inline void caam_qi_algapi_exit(void)
{
}

#endif /* CONFIG_CAAM_QI */

static inline u64 caam_get_dma_mask(struct device *dev)
{}


#endif /* INTERN_H */