drivers/crypto/tegra/tegra-se.h

Source file repositories/reference/linux-study-clean/drivers/crypto/tegra/tegra-se.h

File Facts

System
Linux kernel
Corpus path
drivers/crypto/tegra/tegra-se.h
Extension
.h
Size
19740 bytes
Lines
590
Domain
Driver Families
Bucket
drivers/crypto
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct tegra_se_alg {
	struct tegra_se *se_dev;
	const char *alg_base;

	union {
		struct skcipher_engine_alg skcipher;
		struct aead_engine_alg aead;
		struct ahash_engine_alg ahash;
	} alg;
};

struct tegra_se_regs {
	u32 op;
	u32 config;
	u32 last_blk;
	u32 linear_ctr;
	u32 out_addr;
	u32 aad_len;
	u32 cryp_msg_len;
	u32 manifest;
	u32 key_addr;
	u32 key_data;
	u32 key_dst;
	u32 result;
};

struct tegra_se_hw {
	const struct tegra_se_regs *regs;
	int (*init_alg)(struct tegra_se *se);
	void (*deinit_alg)(struct tegra_se *se);
	bool support_sm_alg;
	u32 host1x_class;
	u32 kac_ver;
};

struct tegra_se {
	int (*manifest)(u32 user, u32 alg, u32 keylen);
	const struct tegra_se_hw *hw;
	struct host1x_client client;
	struct host1x_channel *channel;
	struct tegra_se_cmdbuf *cmdbuf;
	struct tegra_se_cmdbuf *keybuf;
	struct crypto_engine *engine;
	struct host1x_syncpt *syncpt;
	struct device *dev;
	struct clk *clk;
	unsigned int opcode_addr;
	unsigned int stream_id;
	unsigned int syncpt_id;
	void __iomem *base;
	u32 owner;
};

struct tegra_se_cmdbuf {
	dma_addr_t iova;
	u32 *addr;
	struct device *dev;
	struct kref ref;
	struct host1x_bo bo;
	ssize_t size;
	u32 words;
};

struct tegra_se_datbuf {
	u8 *buf;
	dma_addr_t addr;
	ssize_t size;
};

static inline int se_algname_to_algid(const char *name)
{
	if (!strcmp(name, "cbc(aes)"))
		return SE_ALG_CBC;
	else if (!strcmp(name, "ecb(aes)"))
		return SE_ALG_ECB;
	else if (!strcmp(name, "ctr(aes)"))
		return SE_ALG_CTR;
	else if (!strcmp(name, "xts(aes)"))
		return SE_ALG_XTS;
	else if (!strcmp(name, "cmac(aes)"))
		return SE_ALG_CMAC;
	else if (!strcmp(name, "gcm(aes)"))
		return SE_ALG_GCM;
	else if (!strcmp(name, "ccm(aes)"))
		return SE_ALG_CBC_MAC;

	else if (!strcmp(name, "sha1"))
		return SE_ALG_SHA1;
	else if (!strcmp(name, "sha224"))
		return SE_ALG_SHA224;

Annotation

Implementation Notes