Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
0003 
0004 /* \file cc_buffer_mgr.h
0005  * Buffer Manager
0006  */
0007 
0008 #ifndef __CC_BUFFER_MGR_H__
0009 #define __CC_BUFFER_MGR_H__
0010 
0011 #include <crypto/algapi.h>
0012 
0013 #include "cc_driver.h"
0014 
0015 enum cc_req_dma_buf_type {
0016     CC_DMA_BUF_NULL = 0,
0017     CC_DMA_BUF_DLLI,
0018     CC_DMA_BUF_MLLI
0019 };
0020 
0021 enum cc_sg_cpy_direct {
0022     CC_SG_TO_BUF = 0,
0023     CC_SG_FROM_BUF = 1
0024 };
0025 
0026 struct cc_mlli {
0027     u32 sram_addr;
0028     unsigned int mapped_nents;
0029     unsigned int nents; //sg nents
0030     unsigned int mlli_nents; //mlli nents might be different than the above
0031 };
0032 
0033 struct mlli_params {
0034     struct dma_pool *curr_pool;
0035     void *mlli_virt_addr;
0036     dma_addr_t mlli_dma_addr;
0037     u32 mlli_len;
0038 };
0039 
0040 int cc_buffer_mgr_init(struct cc_drvdata *drvdata);
0041 
0042 int cc_buffer_mgr_fini(struct cc_drvdata *drvdata);
0043 
0044 int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx,
0045               unsigned int ivsize, unsigned int nbytes,
0046               void *info, struct scatterlist *src,
0047               struct scatterlist *dst, gfp_t flags);
0048 
0049 void cc_unmap_cipher_request(struct device *dev, void *ctx, unsigned int ivsize,
0050                  struct scatterlist *src, struct scatterlist *dst);
0051 
0052 int cc_map_aead_request(struct cc_drvdata *drvdata, struct aead_request *req);
0053 
0054 void cc_unmap_aead_request(struct device *dev, struct aead_request *req);
0055 
0056 int cc_map_hash_request_final(struct cc_drvdata *drvdata, void *ctx,
0057                   struct scatterlist *src, unsigned int nbytes,
0058                   bool do_update, gfp_t flags);
0059 
0060 int cc_map_hash_request_update(struct cc_drvdata *drvdata, void *ctx,
0061                    struct scatterlist *src, unsigned int nbytes,
0062                    unsigned int block_size, gfp_t flags);
0063 
0064 void cc_unmap_hash_request(struct device *dev, void *ctx,
0065                struct scatterlist *src, bool do_revert);
0066 
0067 void cc_copy_sg_portion(struct device *dev, u8 *dest, struct scatterlist *sg,
0068             u32 to_skip, u32 end, enum cc_sg_cpy_direct direct);
0069 
0070 #endif /*__BUFFER_MGR_H__*/