]>
Commit | Line | Data |
---|---|---|
abefd674 GBY |
1 | /* |
2 | * Copyright (C) 2012-2017 ARM Limited or its affiliates. | |
c8f17865 | 3 | * |
abefd674 GBY |
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. | |
c8f17865 | 7 | * |
abefd674 GBY |
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. | |
c8f17865 | 12 | * |
abefd674 GBY |
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/>. | |
15 | */ | |
16 | ||
17 | /* \file buffer_mgr.h | |
84e8a6cf | 18 | * Buffer Manager |
abefd674 GBY |
19 | */ |
20 | ||
21 | #ifndef __SSI_BUFFER_MGR_H__ | |
22 | #define __SSI_BUFFER_MGR_H__ | |
23 | ||
24 | #include <crypto/algapi.h> | |
25 | ||
26 | #include "ssi_config.h" | |
27 | #include "ssi_driver.h" | |
28 | ||
29 | ||
30 | enum ssi_req_dma_buf_type { | |
31 | SSI_DMA_BUF_NULL = 0, | |
32 | SSI_DMA_BUF_DLLI, | |
33 | SSI_DMA_BUF_MLLI | |
34 | }; | |
35 | ||
36 | enum ssi_sg_cpy_direct { | |
37 | SSI_SG_TO_BUF = 0, | |
38 | SSI_SG_FROM_BUF = 1 | |
39 | }; | |
40 | ||
41 | struct ssi_mlli { | |
42 | ssi_sram_addr_t sram_addr; | |
43 | unsigned int nents; //sg nents | |
44 | unsigned int mlli_nents; //mlli nents might be different than the above | |
45 | }; | |
46 | ||
47 | struct mlli_params { | |
48 | struct dma_pool *curr_pool; | |
a1ab41eb | 49 | u8 *mlli_virt_addr; |
abefd674 | 50 | dma_addr_t mlli_dma_addr; |
a1ab41eb | 51 | u32 mlli_len; |
abefd674 GBY |
52 | }; |
53 | ||
54 | int ssi_buffer_mgr_init(struct ssi_drvdata *drvdata); | |
55 | ||
56 | int ssi_buffer_mgr_fini(struct ssi_drvdata *drvdata); | |
57 | ||
302ef8eb GBY |
58 | int ssi_buffer_mgr_map_blkcipher_request( |
59 | struct ssi_drvdata *drvdata, | |
60 | void *ctx, | |
61 | unsigned int ivsize, | |
62 | unsigned int nbytes, | |
63 | void *info, | |
64 | struct scatterlist *src, | |
65 | struct scatterlist *dst); | |
66 | ||
67 | void ssi_buffer_mgr_unmap_blkcipher_request( | |
c8f17865 | 68 | struct device *dev, |
302ef8eb GBY |
69 | void *ctx, |
70 | unsigned int ivsize, | |
71 | struct scatterlist *src, | |
72 | struct scatterlist *dst); | |
73 | ||
fe0a1951 GBY |
74 | int ssi_buffer_mgr_map_aead_request(struct ssi_drvdata *drvdata, struct aead_request *req); |
75 | ||
76 | void ssi_buffer_mgr_unmap_aead_request(struct device *dev, struct aead_request *req); | |
77 | ||
50cfbbb7 GBY |
78 | int ssi_buffer_mgr_map_hash_request_final(struct ssi_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, bool do_update); |
79 | ||
80 | 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 | ||
82 | void ssi_buffer_mgr_unmap_hash_request(struct device *dev, void *ctx, struct scatterlist *src, bool do_revert); | |
83 | ||
a1ab41eb | 84 | void ssi_buffer_mgr_copy_scatterlist_portion(u8 *dest, struct scatterlist *sg, u32 to_skip, u32 end, enum ssi_sg_cpy_direct direct); |
abefd674 | 85 | |
a1ab41eb | 86 | void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, u32 data_len); |
abefd674 | 87 | |
abefd674 GBY |
88 | #endif /*__BUFFER_MGR_H__*/ |
89 |