2 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef __SSI_BUFFER_MGR_H__
22 #define __SSI_BUFFER_MGR_H__
24 #include <crypto/algapi.h>
26 #include "ssi_config.h"
27 #include "ssi_driver.h"
29 enum ssi_req_dma_buf_type {
35 enum ssi_sg_cpy_direct {
41 ssi_sram_addr_t sram_addr;
42 unsigned int nents; //sg nents
43 unsigned int mlli_nents; //mlli nents might be different than the above
47 struct dma_pool *curr_pool;
49 dma_addr_t mlli_dma_addr;
53 int ssi_buffer_mgr_init(struct ssi_drvdata *drvdata);
55 int ssi_buffer_mgr_fini(struct ssi_drvdata *drvdata);
57 int ssi_buffer_mgr_map_blkcipher_request(
58 struct ssi_drvdata *drvdata,
63 struct scatterlist *src,
64 struct scatterlist *dst);
66 void ssi_buffer_mgr_unmap_blkcipher_request(
70 struct scatterlist *src,
71 struct scatterlist *dst);
73 int ssi_buffer_mgr_map_aead_request(struct ssi_drvdata *drvdata, struct aead_request *req);
75 void ssi_buffer_mgr_unmap_aead_request(struct device *dev, struct aead_request *req);
77 int ssi_buffer_mgr_map_hash_request_final(struct ssi_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, bool do_update);
79 int ssi_buffer_mgr_map_hash_request_update(struct ssi_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, unsigned int block_size);
81 void ssi_buffer_mgr_unmap_hash_request(struct device *dev, void *ctx, struct scatterlist *src, bool do_revert);
83 void ssi_buffer_mgr_copy_scatterlist_portion(u8 *dest, struct scatterlist *sg, u32 to_skip, u32 end, enum ssi_sg_cpy_direct direct);
85 void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, u32 data_len);
87 #endif /*__BUFFER_MGR_H__*/