VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   34 Branches   58 Tags
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000  1) /* SPDX-License-Identifier: GPL-2.0 */
03963caeb0dd7 (Gilad Ben-Yossef   2019-04-18 16:38:53 +0300  2) /* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000  3) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000  4) /* \file cc_buffer_mgr.h
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000  5)  * Buffer Manager
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000  6)  */
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000  7) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000  8) #ifndef __CC_BUFFER_MGR_H__
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000  9) #define __CC_BUFFER_MGR_H__
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 10) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 11) #include <crypto/algapi.h>
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 12) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 13) #include "cc_driver.h"
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 14) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 15) enum cc_req_dma_buf_type {
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 16) 	CC_DMA_BUF_NULL = 0,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 17) 	CC_DMA_BUF_DLLI,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 18) 	CC_DMA_BUF_MLLI
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 19) };
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 20) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 21) enum cc_sg_cpy_direct {
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 22) 	CC_SG_TO_BUF = 0,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 23) 	CC_SG_FROM_BUF = 1
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 24) };
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 25) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 26) struct cc_mlli {
1a895f1d5bcee (Geert Uytterhoeven 2020-02-11 19:19:07 +0100 27) 	u32 sram_addr;
ce0fc6db38dec (Gilad Ben-Yossef   2020-01-29 16:37:54 +0200 28) 	unsigned int mapped_nents;
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 29) 	unsigned int nents; //sg nents
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 30) 	unsigned int mlli_nents; //mlli nents might be different than the above
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 31) };
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 32) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 33) struct mlli_params {
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 34) 	struct dma_pool *curr_pool;
ba99b6f9bd59f (Geert Uytterhoeven 2020-02-11 19:19:03 +0100 35) 	void *mlli_virt_addr;
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 36) 	dma_addr_t mlli_dma_addr;
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 37) 	u32 mlli_len;
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 38) };
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 39) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 40) int cc_buffer_mgr_init(struct cc_drvdata *drvdata);
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 41) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 42) int cc_buffer_mgr_fini(struct cc_drvdata *drvdata);
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 43) 
63ee04c8b491e (Gilad Ben-Yossef   2018-01-22 09:27:01 +0000 44) int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx,
63ee04c8b491e (Gilad Ben-Yossef   2018-01-22 09:27:01 +0000 45) 			  unsigned int ivsize, unsigned int nbytes,
63ee04c8b491e (Gilad Ben-Yossef   2018-01-22 09:27:01 +0000 46) 			  void *info, struct scatterlist *src,
63ee04c8b491e (Gilad Ben-Yossef   2018-01-22 09:27:01 +0000 47) 			  struct scatterlist *dst, gfp_t flags);
63ee04c8b491e (Gilad Ben-Yossef   2018-01-22 09:27:01 +0000 48) 
63ee04c8b491e (Gilad Ben-Yossef   2018-01-22 09:27:01 +0000 49) void cc_unmap_cipher_request(struct device *dev, void *ctx, unsigned int ivsize,
63ee04c8b491e (Gilad Ben-Yossef   2018-01-22 09:27:01 +0000 50) 			     struct scatterlist *src, struct scatterlist *dst);
63ee04c8b491e (Gilad Ben-Yossef   2018-01-22 09:27:01 +0000 51) 
ff27e85a85bbd (Gilad Ben-Yossef   2018-01-22 09:27:03 +0000 52) int cc_map_aead_request(struct cc_drvdata *drvdata, struct aead_request *req);
ff27e85a85bbd (Gilad Ben-Yossef   2018-01-22 09:27:03 +0000 53) 
ff27e85a85bbd (Gilad Ben-Yossef   2018-01-22 09:27:03 +0000 54) void cc_unmap_aead_request(struct device *dev, struct aead_request *req);
ff27e85a85bbd (Gilad Ben-Yossef   2018-01-22 09:27:03 +0000 55) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 56) int cc_map_hash_request_final(struct cc_drvdata *drvdata, void *ctx,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 57) 			      struct scatterlist *src, unsigned int nbytes,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 58) 			      bool do_update, gfp_t flags);
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 59) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 60) int cc_map_hash_request_update(struct cc_drvdata *drvdata, void *ctx,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 61) 			       struct scatterlist *src, unsigned int nbytes,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 62) 			       unsigned int block_size, gfp_t flags);
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 63) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 64) void cc_unmap_hash_request(struct device *dev, void *ctx,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 65) 			   struct scatterlist *src, bool do_revert);
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 66) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 67) void cc_copy_sg_portion(struct device *dev, u8 *dest, struct scatterlist *sg,
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 68) 			u32 to_skip, u32 end, enum cc_sg_cpy_direct direct);
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 69) 
4c3f97276e156 (Gilad Ben-Yossef   2018-01-22 09:27:00 +0000 70) #endif /*__BUFFER_MGR_H__*/