| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: BSD-3-Clause */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Freescale SEC (talitos) device register and descriptor header defines |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2006-2011 Freescale Semiconductor, Inc. |
|---|
| 5 | | - * |
|---|
| 6 | | - * Redistribution and use in source and binary forms, with or without |
|---|
| 7 | | - * modification, are permitted provided that the following conditions |
|---|
| 8 | | - * are met: |
|---|
| 9 | | - * |
|---|
| 10 | | - * 1. Redistributions of source code must retain the above copyright |
|---|
| 11 | | - * notice, this list of conditions and the following disclaimer. |
|---|
| 12 | | - * 2. Redistributions in binary form must reproduce the above copyright |
|---|
| 13 | | - * notice, this list of conditions and the following disclaimer in the |
|---|
| 14 | | - * documentation and/or other materials provided with the distribution. |
|---|
| 15 | | - * 3. The name of the author may not be used to endorse or promote products |
|---|
| 16 | | - * derived from this software without specific prior written permission. |
|---|
| 17 | | - * |
|---|
| 18 | | - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|---|
| 19 | | - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|---|
| 20 | | - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|---|
| 21 | | - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
|---|
| 22 | | - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
|---|
| 23 | | - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|---|
| 24 | | - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|---|
| 25 | | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|---|
| 26 | | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|---|
| 27 | | - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 28 | | - * |
|---|
| 29 | 6 | */ |
|---|
| 30 | 7 | |
|---|
| 31 | 8 | #define TALITOS_TIMEOUT 100000 |
|---|
| .. | .. |
|---|
| 69 | 46 | * talitos_edesc - s/w-extended descriptor |
|---|
| 70 | 47 | * @src_nents: number of segments in input scatterlist |
|---|
| 71 | 48 | * @dst_nents: number of segments in output scatterlist |
|---|
| 72 | | - * @icv_ool: whether ICV is out-of-line |
|---|
| 73 | 49 | * @iv_dma: dma address of iv for checking continuity and link table |
|---|
| 74 | 50 | * @dma_len: length of dma mapped link_tbl space |
|---|
| 75 | 51 | * @dma_link_tbl: bus physical address of link_tbl/buf |
|---|
| .. | .. |
|---|
| 84 | 60 | struct talitos_edesc { |
|---|
| 85 | 61 | int src_nents; |
|---|
| 86 | 62 | int dst_nents; |
|---|
| 87 | | - bool icv_ool; |
|---|
| 88 | 63 | dma_addr_t iv_dma; |
|---|
| 89 | 64 | int dma_len; |
|---|
| 90 | 65 | dma_addr_t dma_link_tbl; |
|---|
| .. | .. |
|---|
| 180 | 155 | bool rng_registered; |
|---|
| 181 | 156 | }; |
|---|
| 182 | 157 | |
|---|
| 183 | | -extern int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc, |
|---|
| 184 | | - void (*callback)(struct device *dev, |
|---|
| 185 | | - struct talitos_desc *desc, |
|---|
| 186 | | - void *context, int error), |
|---|
| 187 | | - void *context); |
|---|
| 188 | | - |
|---|
| 189 | 158 | /* .features flag */ |
|---|
| 190 | 159 | #define TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT 0x00000001 |
|---|
| 191 | 160 | #define TALITOS_FTR_HW_AUTH_CHECK 0x00000002 |
|---|
| .. | .. |
|---|
| 200 | 169 | */ |
|---|
| 201 | 170 | static inline bool has_ftr_sec1(struct talitos_private *priv) |
|---|
| 202 | 171 | { |
|---|
| 203 | | -#if defined(CONFIG_CRYPTO_DEV_TALITOS1) && defined(CONFIG_CRYPTO_DEV_TALITOS2) |
|---|
| 204 | | - return priv->features & TALITOS_FTR_SEC1 ? true : false; |
|---|
| 205 | | -#elif defined(CONFIG_CRYPTO_DEV_TALITOS1) |
|---|
| 206 | | - return true; |
|---|
| 207 | | -#else |
|---|
| 208 | | - return false; |
|---|
| 209 | | -#endif |
|---|
| 172 | + if (IS_ENABLED(CONFIG_CRYPTO_DEV_TALITOS1) && |
|---|
| 173 | + IS_ENABLED(CONFIG_CRYPTO_DEV_TALITOS2)) |
|---|
| 174 | + return priv->features & TALITOS_FTR_SEC1; |
|---|
| 175 | + |
|---|
| 176 | + return IS_ENABLED(CONFIG_CRYPTO_DEV_TALITOS1); |
|---|
| 210 | 177 | } |
|---|
| 211 | 178 | |
|---|
| 212 | 179 | /* |
|---|