1 /*******************************************************************************
2 Copyright (C) Marvell International Ltd. and its affiliates
4 This software file (the "File") is owned and distributed by Marvell
5 International Ltd. and/or its affiliates ("Marvell") under the following
6 alternative licensing terms. Once you have made an election to distribute the
7 File under one of the following license alternatives, please (i) delete this
8 introductory statement regarding license alternatives, (ii) delete the two
9 license alternatives that you have not elected to use and (iii) preserve the
10 Marvell copyright notice above.
12 ********************************************************************************
13 Marvell Commercial License Option
15 If you received this File from Marvell and you have entered into a commercial
16 license agreement (a "Commercial License") with Marvell, the File is licensed
17 to you under the terms of the applicable Commercial License.
19 ********************************************************************************
20 Marvell GPL License Option
22 If you received this File from Marvell, you may opt to use, redistribute and/or
23 modify this File in accordance with the terms and conditions of the General
24 Public License Version 2, June 1991 (the "GPL License"), a copy of which is
25 available along with the File in the license.txt file or by writing to the Free
26 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or
27 on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
29 THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED
30 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
31 DISCLAIMED. The GPL License provides additional details about this warranty
33 ********************************************************************************
34 Marvell BSD License Option
36 If you received this File from Marvell, you may opt to use, redistribute and/or
37 modify this File under the following licensing terms.
38 Redistribution and use in source and binary forms, with or without modification,
39 are permitted provided that the following conditions are met:
41 * Redistributions of source code must retain the above copyright notice,
42 this list of conditions and the following disclaimer.
44 * Redistributions in binary form must reproduce the above copyright
45 notice, this list of conditions and the following disclaimer in the
46 documentation and/or other materials provided with the distribution.
48 * Neither the name of Marvell nor the names of its contributors may be
49 used to endorse or promote products derived from this software without
50 specific prior written permission.
52 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
53 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
56 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
57 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
58 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
59 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
61 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 *******************************************************************************/
65 #ifndef __mvCesaRegs_h__
66 #define __mvCesaRegs_h__
75 MV_U16 cryptoSrcOffset
;
76 MV_U16 cryptoDstOffset
;
81 MV_U16 cryptoKeyOffset
;
84 MV_U16 cryptoIvOffset
;
85 MV_U16 cryptoIvBufOffset
;
90 MV_U16 macDigestOffset
;
93 MV_U16 macInnerIvOffset
;
94 MV_U16 macOuterIvOffset
;
101 MV_CESA_MAC_ONLY
= 0,
102 MV_CESA_CRYPTO_ONLY
= 1,
103 MV_CESA_MAC_THEN_CRYPTO
= 2,
104 MV_CESA_CRYPTO_THEN_MAC
= 3,
106 MV_CESA_MAX_OPERATION
110 #define MV_CESA_OPERATION_OFFSET 0
111 #define MV_CESA_OPERATION_MASK (0x3 << MV_CESA_OPERATION_OFFSET)
116 MV_CESA_MAC_NULL
= 0,
118 MV_CESA_MAC_SHA1
= 5,
119 MV_CESA_MAC_HMAC_MD5
= 6,
120 MV_CESA_MAC_HMAC_SHA1
= 7,
124 #define MV_CESA_MAC_MODE_OFFSET 4
125 #define MV_CESA_MAC_MODE_MASK (0x7 << MV_CESA_MAC_MODE_OFFSET)
129 MV_CESA_MAC_DIGEST_FULL
= 0,
130 MV_CESA_MAC_DIGEST_96B
= 1,
132 } MV_CESA_MAC_DIGEST_SIZE
;
134 #define MV_CESA_MAC_DIGEST_SIZE_BIT 7
135 #define MV_CESA_MAC_DIGEST_SIZE_MASK (1 << MV_CESA_MAC_DIGEST_SIZE_BIT)
140 MV_CESA_CRYPTO_NULL
= 0,
141 MV_CESA_CRYPTO_DES
= 1,
142 MV_CESA_CRYPTO_3DES
= 2,
143 MV_CESA_CRYPTO_AES
= 3,
145 } MV_CESA_CRYPTO_ALG
;
147 #define MV_CESA_CRYPTO_ALG_OFFSET 8
148 #define MV_CESA_CRYPTO_ALG_MASK (0x3 << MV_CESA_CRYPTO_ALG_OFFSET)
154 MV_CESA_DIR_ENCODE
= 0,
155 MV_CESA_DIR_DECODE
= 1,
159 #define MV_CESA_DIRECTION_BIT 12
160 #define MV_CESA_DIRECTION_MASK (1 << MV_CESA_DIRECTION_BIT)
165 MV_CESA_CRYPTO_ECB
= 0,
166 MV_CESA_CRYPTO_CBC
= 1,
169 MV_CESA_CRYPTO_CTR
= 10,
171 } MV_CESA_CRYPTO_MODE
;
173 #define MV_CESA_CRYPTO_MODE_BIT 16
174 #define MV_CESA_CRYPTO_MODE_MASK (1 << MV_CESA_CRYPTO_MODE_BIT)
179 MV_CESA_CRYPTO_3DES_EEE
= 0,
180 MV_CESA_CRYPTO_3DES_EDE
= 1,
182 } MV_CESA_CRYPTO_3DES_MODE
;
184 #define MV_CESA_CRYPTO_3DES_MODE_BIT 20
185 #define MV_CESA_CRYPTO_3DES_MODE_MASK (1 << MV_CESA_CRYPTO_3DES_MODE_BIT)
191 MV_CESA_CRYPTO_AES_KEY_128
= 0,
192 MV_CESA_CRYPTO_AES_KEY_192
= 1,
193 MV_CESA_CRYPTO_AES_KEY_256
= 2,
195 } MV_CESA_CRYPTO_AES_KEY_LEN
;
197 #define MV_CESA_CRYPTO_AES_KEY_LEN_OFFSET 24
198 #define MV_CESA_CRYPTO_AES_KEY_LEN_MASK (0x3 << MV_CESA_CRYPTO_AES_KEY_LEN_OFFSET)
200 /* Fragmentation mode */
203 MV_CESA_FRAG_NONE
= 0,
204 MV_CESA_FRAG_FIRST
= 1,
205 MV_CESA_FRAG_LAST
= 2,
206 MV_CESA_FRAG_MIDDLE
= 3,
210 #define MV_CESA_FRAG_MODE_OFFSET 30
211 #define MV_CESA_FRAG_MODE_MASK (0x3 << MV_CESA_FRAG_MODE_OFFSET)
212 /*---------------------------------------------------------------------------*/
214 /********** Security Accelerator Command Register **************/
215 #define MV_CESA_CMD_REG (MV_CESA_REG_BASE + 0xE00)
217 #define MV_CESA_CMD_CHAN_ENABLE_BIT 0
218 #define MV_CESA_CMD_CHAN_ENABLE_MASK (1 << MV_CESA_CMD_CHAN_ENABLE_BIT)
220 #define MV_CESA_CMD_CHAN_DISABLE_BIT 2
221 #define MV_CESA_CMD_CHAN_DISABLE_MASK (1 << MV_CESA_CMD_CHAN_DISABLE_BIT)
223 /********** Security Accelerator Descriptor Pointers Register **********/
224 #define MV_CESA_CHAN_DESC_OFFSET_REG (MV_CESA_REG_BASE + 0xE04)
226 /********** Security Accelerator Configuration Register **********/
227 #define MV_CESA_CFG_REG (MV_CESA_REG_BASE + 0xE08)
229 #define MV_CESA_CFG_STOP_DIGEST_ERR_BIT 0
230 #define MV_CESA_CFG_STOP_DIGEST_ERR_MASK (1 << MV_CESA_CFG_STOP_DIGEST_ERR_BIT)
232 #define MV_CESA_CFG_WAIT_DMA_BIT 7
233 #define MV_CESA_CFG_WAIT_DMA_MASK (1 << MV_CESA_CFG_WAIT_DMA_BIT)
235 #define MV_CESA_CFG_ACT_DMA_BIT 9
236 #define MV_CESA_CFG_ACT_DMA_MASK (1 << MV_CESA_CFG_ACT_DMA_BIT)
238 #define MV_CESA_CFG_CHAIN_MODE_BIT 11
239 #define MV_CESA_CFG_CHAIN_MODE_MASK (1 << MV_CESA_CFG_CHAIN_MODE_BIT)
241 /********** Security Accelerator Status Register ***********/
242 #define MV_CESA_STATUS_REG (MV_CESA_REG_BASE + 0xE0C)
244 #define MV_CESA_STATUS_ACTIVE_BIT 0
245 #define MV_CESA_STATUS_ACTIVE_MASK (1 << MV_CESA_STATUS_ACTIVE_BIT)
247 #define MV_CESA_STATUS_DIGEST_ERR_BIT 8
248 #define MV_CESA_STATUS_DIGEST_ERR_MASK (1 << MV_CESA_STATUS_DIGEST_ERR_BIT)
251 /* Cryptographic Engines and Security Accelerator Interrupt Cause Register */
252 #define MV_CESA_ISR_CAUSE_REG (MV_CESA_REG_BASE + 0xE20)
254 /* Cryptographic Engines and Security Accelerator Interrupt Mask Register */
255 #define MV_CESA_ISR_MASK_REG (MV_CESA_REG_BASE + 0xE24)
257 #define MV_CESA_CAUSE_AUTH_MASK (1 << 0)
258 #define MV_CESA_CAUSE_DES_MASK (1 << 1)
259 #define MV_CESA_CAUSE_AES_ENCR_MASK (1 << 2)
260 #define MV_CESA_CAUSE_AES_DECR_MASK (1 << 3)
261 #define MV_CESA_CAUSE_DES_ALL_MASK (1 << 4)
263 #define MV_CESA_CAUSE_ACC_BIT 5
264 #define MV_CESA_CAUSE_ACC_MASK (1 << MV_CESA_CAUSE_ACC_BIT)
266 #define MV_CESA_CAUSE_ACC_DMA_BIT 7
267 #define MV_CESA_CAUSE_ACC_DMA_MASK (1 << MV_CESA_CAUSE_ACC_DMA_BIT)
268 #define MV_CESA_CAUSE_ACC_DMA_ALL_MASK (3 << MV_CESA_CAUSE_ACC_DMA_BIT)
270 #define MV_CESA_CAUSE_DMA_COMPL_BIT 9
271 #define MV_CESA_CAUSE_DMA_COMPL_MASK (1 << MV_CESA_CAUSE_DMA_COMPL_BIT)
273 #define MV_CESA_CAUSE_DMA_OWN_ERR_BIT 10
274 #define MV_CESA_CAUSE_DMA_OWN_ERR_MASK (1 < MV_CESA_CAUSE_DMA_OWN_ERR_BIT)
276 #define MV_CESA_CAUSE_DMA_CHAIN_PKT_BIT 11
277 #define MV_CESA_CAUSE_DMA_CHAIN_PKT_MASK (1 < MV_CESA_CAUSE_DMA_CHAIN_PKT_BIT)
280 #define MV_CESA_AUTH_DATA_IN_REG (MV_CESA_REG_BASE + 0xd38)
281 #define MV_CESA_AUTH_BIT_COUNT_LOW_REG (MV_CESA_REG_BASE + 0xd20)
282 #define MV_CESA_AUTH_BIT_COUNT_HIGH_REG (MV_CESA_REG_BASE + 0xd24)
284 #define MV_CESA_AUTH_INIT_VAL_DIGEST_REG(i) (MV_CESA_REG_BASE + 0xd00 + (i<<2))
286 #define MV_CESA_AUTH_INIT_VAL_DIGEST_A_REG (MV_CESA_REG_BASE + 0xd00)
287 #define MV_CESA_AUTH_INIT_VAL_DIGEST_B_REG (MV_CESA_REG_BASE + 0xd04)
288 #define MV_CESA_AUTH_INIT_VAL_DIGEST_C_REG (MV_CESA_REG_BASE + 0xd08)
289 #define MV_CESA_AUTH_INIT_VAL_DIGEST_D_REG (MV_CESA_REG_BASE + 0xd0c)
290 #define MV_CESA_AUTH_INIT_VAL_DIGEST_E_REG (MV_CESA_REG_BASE + 0xd10)
291 #define MV_CESA_AUTH_COMMAND_REG (MV_CESA_REG_BASE + 0xd18)
293 #define MV_CESA_AUTH_ALGORITHM_BIT 0
294 #define MV_CESA_AUTH_ALGORITHM_MD5 (0<<AUTH_ALGORITHM_BIT)
295 #define MV_CESA_AUTH_ALGORITHM_SHA1 (1<<AUTH_ALGORITHM_BIT)
297 #define MV_CESA_AUTH_IV_MODE_BIT 1
298 #define MV_CESA_AUTH_IV_MODE_INIT (0<<AUTH_IV_MODE_BIT)
299 #define MV_CESA_AUTH_IV_MODE_CONTINUE (1<<AUTH_IV_MODE_BIT)
301 #define MV_CESA_AUTH_DATA_BYTE_SWAP_BIT 2
302 #define MV_CESA_AUTH_DATA_BYTE_SWAP_MASK (1<<AUTH_DATA_BYTE_SWAP_BIT)
305 #define MV_CESA_AUTH_IV_BYTE_SWAP_BIT 4
306 #define MV_CESA_AUTH_IV_BYTE_SWAP_MASK (1<<AUTH_IV_BYTE_SWAP_BIT)
308 #define MV_CESA_AUTH_TERMINATION_BIT 31
309 #define MV_CESA_AUTH_TERMINATION_MASK (1<<AUTH_TERMINATION_BIT)
312 /*************** TDMA Control Register ************************************************/
313 #define MV_CESA_TDMA_CTRL_REG (MV_CESA_TDMA_REG_BASE + 0x840)
315 #define MV_CESA_TDMA_BURST_32B 3
316 #define MV_CESA_TDMA_BURST_128B 4
318 #define MV_CESA_TDMA_DST_BURST_OFFSET 0
319 #define MV_CESA_TDMA_DST_BURST_ALL_MASK (0x7<<MV_CESA_TDMA_DST_BURST_OFFSET)
320 #define MV_CESA_TDMA_DST_BURST_MASK(burst) ((burst)<<MV_CESA_TDMA_DST_BURST_OFFSET)
322 #define MV_CESA_TDMA_OUTSTAND_READ_EN_BIT 4
323 #define MV_CESA_TDMA_OUTSTAND_READ_EN_MASK (1<<MV_CESA_TDMA_OUTSTAND_READ_EN_BIT)
325 #define MV_CESA_TDMA_SRC_BURST_OFFSET 6
326 #define MV_CESA_TDMA_SRC_BURST_ALL_MASK (0x7<<MV_CESA_TDMA_SRC_BURST_OFFSET)
327 #define MV_CESA_TDMA_SRC_BURST_MASK(burst) ((burst)<<MV_CESA_TDMA_SRC_BURST_OFFSET)
329 #define MV_CESA_TDMA_CHAIN_MODE_BIT 9
330 #define MV_CESA_TDMA_NON_CHAIN_MODE_MASK (1<<MV_CESA_TDMA_CHAIN_MODE_BIT)
332 #define MV_CESA_TDMA_BYTE_SWAP_BIT 11
333 #define MV_CESA_TDMA_BYTE_SWAP_MASK (0 << MV_CESA_TDMA_BYTE_SWAP_BIT)
334 #define MV_CESA_TDMA_NO_BYTE_SWAP_MASK (1 << MV_CESA_TDMA_BYTE_SWAP_BIT)
336 #define MV_CESA_TDMA_ENABLE_BIT 12
337 #define MV_CESA_TDMA_ENABLE_MASK (1<<MV_CESA_TDMA_ENABLE_BIT)
339 #define MV_CESA_TDMA_FETCH_NEXT_DESC_BIT 13
340 #define MV_CESA_TDMA_FETCH_NEXT_DESC_MASK (1<<MV_CESA_TDMA_FETCH_NEXT_DESC_BIT)
342 #define MV_CESA_TDMA_CHAN_ACTIVE_BIT 14
343 #define MV_CESA_TDMA_CHAN_ACTIVE_MASK (1<<MV_CESA_TDMA_CHAN_ACTIVE_BIT)
344 /*------------------------------------------------------------------------------------*/
346 #define MV_CESA_TDMA_BYTE_COUNT_REG (MV_CESA_TDMA_REG_BASE + 0x800)
347 #define MV_CESA_TDMA_SRC_ADDR_REG (MV_CESA_TDMA_REG_BASE + 0x810)
348 #define MV_CESA_TDMA_DST_ADDR_REG (MV_CESA_TDMA_REG_BASE + 0x820)
349 #define MV_CESA_TDMA_NEXT_DESC_PTR_REG (MV_CESA_TDMA_REG_BASE + 0x830)
350 #define MV_CESA_TDMA_CURR_DESC_PTR_REG (MV_CESA_TDMA_REG_BASE + 0x870)
352 #define MV_CESA_TDMA_ERROR_CAUSE_REG (MV_CESA_TDMA_REG_BASE + 0x8C0)
353 #define MV_CESA_TDMA_ERROR_MASK_REG (MV_CESA_TDMA_REG_BASE + 0x8C4)
356 #endif /* __mvCesaRegs_h__ */