1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
4 /* \file cc_buffer_mgr.h
8 #ifndef __CC_BUFFER_MGR_H__
9 #define __CC_BUFFER_MGR_H__
11 #include <crypto/algapi.h>
13 #include "cc_driver.h"
15 enum cc_req_dma_buf_type
{
21 enum cc_sg_cpy_direct
{
28 unsigned int mapped_nents
;
29 unsigned int nents
; //sg nents
30 unsigned int mlli_nents
; //mlli nents might be different than the above
34 struct dma_pool
*curr_pool
;
36 dma_addr_t mlli_dma_addr
;
40 int cc_buffer_mgr_init(struct cc_drvdata
*drvdata
);
42 int cc_buffer_mgr_fini(struct cc_drvdata
*drvdata
);
44 int cc_map_cipher_request(struct cc_drvdata
*drvdata
, void *ctx
,
45 unsigned int ivsize
, unsigned int nbytes
,
46 void *info
, struct scatterlist
*src
,
47 struct scatterlist
*dst
, gfp_t flags
);
49 void cc_unmap_cipher_request(struct device
*dev
, void *ctx
, unsigned int ivsize
,
50 struct scatterlist
*src
, struct scatterlist
*dst
);
52 int cc_map_aead_request(struct cc_drvdata
*drvdata
, struct aead_request
*req
);
54 void cc_unmap_aead_request(struct device
*dev
, struct aead_request
*req
);
56 int cc_map_hash_request_final(struct cc_drvdata
*drvdata
, void *ctx
,
57 struct scatterlist
*src
, unsigned int nbytes
,
58 bool do_update
, gfp_t flags
);
60 int cc_map_hash_request_update(struct cc_drvdata
*drvdata
, void *ctx
,
61 struct scatterlist
*src
, unsigned int nbytes
,
62 unsigned int block_size
, gfp_t flags
);
64 void cc_unmap_hash_request(struct device
*dev
, void *ctx
,
65 struct scatterlist
*src
, bool do_revert
);
67 void cc_copy_sg_portion(struct device
*dev
, u8
*dest
, struct scatterlist
*sg
,
68 u32 to_skip
, u32 end
, enum cc_sg_cpy_direct direct
);
70 #endif /*__BUFFER_MGR_H__*/