blob: 163cfe733bf055d36e5bbf21591d8571e3a0da96 [file] [log] [blame]
Kim Phillips9c4a7962008-06-23 19:50:15 +08001/*
2 * Freescale SEC (talitos) device register and descriptor header defines
3 *
Kim Phillipsad42d5f2011-11-21 16:13:27 +08004 * Copyright (c) 2006-2011 Freescale Semiconductor, Inc.
Kim Phillips9c4a7962008-06-23 19:50:15 +08005 *
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 */
30
Horia Geantad1a0eb92012-07-03 19:16:51 +030031#define TALITOS_TIMEOUT 100000
LEROY Christophe6f65f6a2015-04-17 16:32:15 +020032#define TALITOS1_MAX_DATA_LEN 32768
33#define TALITOS2_MAX_DATA_LEN 65535
Horia Geantad1a0eb92012-07-03 19:16:51 +030034
35#define DESC_TYPE(desc_hdr) ((be32_to_cpu(desc_hdr) >> 3) & 0x1f)
36#define PRIMARY_EU(desc_hdr) ((be32_to_cpu(desc_hdr) >> 28) & 0xf)
37#define SECONDARY_EU(desc_hdr) ((be32_to_cpu(desc_hdr) >> 16) & 0xf)
38
39/* descriptor pointer entry */
40struct talitos_ptr {
LEROY Christophe90490752015-04-17 16:32:01 +020041 union {
42 struct { /* SEC2 format */
43 __be16 len; /* length */
44 u8 j_extent; /* jump to sg link table and/or extent*/
45 u8 eptr; /* extended address */
46 };
47 struct { /* SEC1 format */
48 __be16 res;
49 __be16 len1; /* length */
50 };
51 };
Horia Geantad1a0eb92012-07-03 19:16:51 +030052 __be32 ptr; /* address */
53};
54
Aaron Sierra76bea642015-08-03 18:56:21 -050055static const struct talitos_ptr zero_entry;
Horia Geantad1a0eb92012-07-03 19:16:51 +030056
57/* descriptor */
58struct talitos_desc {
59 __be32 hdr; /* header high bits */
LEROY Christophe90490752015-04-17 16:32:01 +020060 union {
61 __be32 hdr_lo; /* header low bits */
62 __be32 hdr1; /* header for SEC1 */
63 };
Horia Geantad1a0eb92012-07-03 19:16:51 +030064 struct talitos_ptr ptr[7]; /* ptr/len pair array */
LEROY Christophe90490752015-04-17 16:32:01 +020065 __be32 next_desc; /* next descriptor (SEC1) */
Horia Geantad1a0eb92012-07-03 19:16:51 +030066};
67
LEROY Christophe7d607c6a2015-04-17 16:32:09 +020068#define TALITOS_DESC_SIZE (sizeof(struct talitos_desc) - sizeof(__be32))
69
Horia Geantad1a0eb92012-07-03 19:16:51 +030070/**
71 * talitos_request - descriptor submission request
72 * @desc: descriptor pointer (kernel virtual)
73 * @dma_desc: descriptor's physical bus address
74 * @callback: whom to call when descriptor processing is done
75 * @context: caller context (optional)
76 */
77struct talitos_request {
78 struct talitos_desc *desc;
79 dma_addr_t dma_desc;
80 void (*callback) (struct device *dev, struct talitos_desc *desc,
81 void *context, int error);
82 void *context;
83};
84
85/* per-channel fifo management */
86struct talitos_channel {
87 void __iomem *reg;
88
89 /* request fifo */
90 struct talitos_request *fifo;
91
92 /* number of requests pending in channel h/w fifo */
93 atomic_t submit_count ____cacheline_aligned;
94
95 /* request submission (head) lock */
96 spinlock_t head_lock ____cacheline_aligned;
97 /* index to next free descriptor request */
98 int head;
99
100 /* request release (tail) lock */
101 spinlock_t tail_lock ____cacheline_aligned;
102 /* index to next in-progress/done descriptor request */
103 int tail;
104};
105
106struct talitos_private {
107 struct device *dev;
108 struct platform_device *ofdev;
109 void __iomem *reg;
LEROY Christophe5fa7fa12015-04-17 16:32:11 +0200110 void __iomem *reg_deu;
111 void __iomem *reg_aesu;
112 void __iomem *reg_mdeu;
113 void __iomem *reg_afeu;
114 void __iomem *reg_rngu;
115 void __iomem *reg_pkeu;
116 void __iomem *reg_keu;
117 void __iomem *reg_crcu;
Horia Geantad1a0eb92012-07-03 19:16:51 +0300118 int irq[2];
119
120 /* SEC global registers lock */
121 spinlock_t reg_lock ____cacheline_aligned;
122
123 /* SEC version geometry (from device tree node) */
124 unsigned int num_channels;
125 unsigned int chfifo_len;
126 unsigned int exec_units;
127 unsigned int desc_types;
128
129 /* SEC Compatibility info */
130 unsigned long features;
131
132 /*
133 * length of the request fifo
134 * fifo_len is chfifo_len rounded up to next power of 2
135 * so we can use bitwise ops to wrap
136 */
137 unsigned int fifo_len;
138
139 struct talitos_channel *chan;
140
141 /* next channel to be assigned next incoming descriptor */
142 atomic_t last_chan ____cacheline_aligned;
143
144 /* request callback tasklet */
145 struct tasklet_struct done_task[2];
146
147 /* list of registered algorithms */
148 struct list_head alg_list;
149
150 /* hwrng device */
151 struct hwrng rng;
152};
153
Horia Geanta865d5062012-07-03 19:16:52 +0300154extern int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc,
155 void (*callback)(struct device *dev,
156 struct talitos_desc *desc,
157 void *context, int error),
158 void *context);
159
Horia Geantad1a0eb92012-07-03 19:16:51 +0300160/* .features flag */
161#define TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT 0x00000001
162#define TALITOS_FTR_HW_AUTH_CHECK 0x00000002
163#define TALITOS_FTR_SHA224_HWINIT 0x00000004
164#define TALITOS_FTR_HMAC_OK 0x00000008
LEROY Christophe21590882015-04-17 16:32:05 +0200165#define TALITOS_FTR_SEC1 0x00000010
166
167/*
168 * If both CONFIG_CRYPTO_DEV_TALITOS1 and CONFIG_CRYPTO_DEV_TALITOS2 are
169 * defined, we check the features which are set according to the device tree.
170 * Otherwise, we answer true or false directly
171 */
172static inline bool has_ftr_sec1(struct talitos_private *priv)
173{
174#if defined(CONFIG_CRYPTO_DEV_TALITOS1) && defined(CONFIG_CRYPTO_DEV_TALITOS2)
175 return priv->features & TALITOS_FTR_SEC1 ? true : false;
176#elif defined(CONFIG_CRYPTO_DEV_TALITOS1)
177 return true;
178#else
179 return false;
180#endif
181}
Horia Geantad1a0eb92012-07-03 19:16:51 +0300182
Kim Phillips9c4a7962008-06-23 19:50:15 +0800183/*
184 * TALITOS_xxx_LO addresses point to the low data bits (32-63) of the register
185 */
186
LEROY Christophedd3c0982015-04-17 16:32:13 +0200187#define ISR1_FORMAT(x) (((x) << 28) | ((x) << 16))
188#define ISR2_FORMAT(x) (((x) << 4) | (x))
189
Kim Phillips9c4a7962008-06-23 19:50:15 +0800190/* global register offset addresses */
191#define TALITOS_MCR 0x1030 /* master control register */
Kim Phillipsc3e337f2011-11-21 16:13:27 +0800192#define TALITOS_MCR_RCA0 (1 << 15) /* remap channel 0 */
193#define TALITOS_MCR_RCA1 (1 << 14) /* remap channel 1 */
194#define TALITOS_MCR_RCA2 (1 << 13) /* remap channel 2 */
195#define TALITOS_MCR_RCA3 (1 << 12) /* remap channel 3 */
LEROY Christophedd3c0982015-04-17 16:32:13 +0200196#define TALITOS1_MCR_SWR 0x1000000 /* s/w reset */
197#define TALITOS2_MCR_SWR 0x1 /* s/w reset */
Kim Phillipsc3e337f2011-11-21 16:13:27 +0800198#define TALITOS_MCR_LO 0x1034
Kim Phillips9c4a7962008-06-23 19:50:15 +0800199#define TALITOS_IMR 0x1008 /* interrupt mask register */
LEROY Christophedd3c0982015-04-17 16:32:13 +0200200/* enable channel IRQs */
201#define TALITOS1_IMR_INIT ISR1_FORMAT(0xf)
202#define TALITOS1_IMR_DONE ISR1_FORMAT(0x5) /* done IRQs */
203/* enable channel IRQs */
204#define TALITOS2_IMR_INIT (ISR2_FORMAT(0xf) | 0x10000)
205#define TALITOS2_IMR_DONE ISR1_FORMAT(0x5) /* done IRQs */
Kim Phillips9c4a7962008-06-23 19:50:15 +0800206#define TALITOS_IMR_LO 0x100C
LEROY Christophedd3c0982015-04-17 16:32:13 +0200207#define TALITOS1_IMR_LO_INIT 0x2000000 /* allow RNGU error IRQs */
208#define TALITOS2_IMR_LO_INIT 0x20000 /* allow RNGU error IRQs */
Kim Phillips9c4a7962008-06-23 19:50:15 +0800209#define TALITOS_ISR 0x1010 /* interrupt status register */
LEROY Christophedd3c0982015-04-17 16:32:13 +0200210#define TALITOS1_ISR_4CHERR ISR1_FORMAT(0xa) /* 4 ch errors mask */
211#define TALITOS1_ISR_4CHDONE ISR1_FORMAT(0x5) /* 4 ch done mask */
212#define TALITOS1_ISR_TEA_ERR 0x00000040
213#define TALITOS2_ISR_4CHERR ISR2_FORMAT(0xa) /* 4 ch errors mask */
214#define TALITOS2_ISR_4CHDONE ISR2_FORMAT(0x5) /* 4 ch done mask */
215#define TALITOS2_ISR_CH_0_2_ERR ISR2_FORMAT(0x2) /* ch 0, 2 err mask */
216#define TALITOS2_ISR_CH_0_2_DONE ISR2_FORMAT(0x1) /* ch 0, 2 done mask */
217#define TALITOS2_ISR_CH_1_3_ERR ISR2_FORMAT(0x8) /* ch 1, 3 err mask */
218#define TALITOS2_ISR_CH_1_3_DONE ISR2_FORMAT(0x4) /* ch 1, 3 done mask */
Kim Phillips9c4a7962008-06-23 19:50:15 +0800219#define TALITOS_ISR_LO 0x1014
220#define TALITOS_ICR 0x1018 /* interrupt clear register */
221#define TALITOS_ICR_LO 0x101C
222
223/* channel register address stride */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800224#define TALITOS_CH_BASE_OFFSET 0x1000 /* default channel map base */
LEROY Christophe5fa7fa12015-04-17 16:32:11 +0200225#define TALITOS1_CH_STRIDE 0x1000
226#define TALITOS2_CH_STRIDE 0x100
Kim Phillips9c4a7962008-06-23 19:50:15 +0800227
228/* channel configuration register */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800229#define TALITOS_CCCR 0x8
LEROY Christophedd3c0982015-04-17 16:32:13 +0200230#define TALITOS2_CCCR_CONT 0x2 /* channel continue on SEC2 */
231#define TALITOS2_CCCR_RESET 0x1 /* channel reset on SEC2 */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800232#define TALITOS_CCCR_LO 0xc
Kim Phillipsfe5720e2008-10-12 20:33:14 +0800233#define TALITOS_CCCR_LO_IWSE 0x80 /* chan. ICCR writeback enab. */
Kim Phillips81eb0242009-08-13 11:51:51 +1000234#define TALITOS_CCCR_LO_EAE 0x20 /* extended address enable */
Kim Phillips9c4a7962008-06-23 19:50:15 +0800235#define TALITOS_CCCR_LO_CDWE 0x10 /* chan. done writeback enab. */
236#define TALITOS_CCCR_LO_NT 0x4 /* notification type */
237#define TALITOS_CCCR_LO_CDIE 0x2 /* channel done IRQ enable */
LEROY Christophedd3c0982015-04-17 16:32:13 +0200238#define TALITOS1_CCCR_LO_RESET 0x1 /* channel reset on SEC1 */
Kim Phillips9c4a7962008-06-23 19:50:15 +0800239
240/* CCPSR: channel pointer status register */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800241#define TALITOS_CCPSR 0x10
242#define TALITOS_CCPSR_LO 0x14
Kim Phillips9c4a7962008-06-23 19:50:15 +0800243#define TALITOS_CCPSR_LO_DOF 0x8000 /* double FF write oflow error */
244#define TALITOS_CCPSR_LO_SOF 0x4000 /* single FF write oflow error */
245#define TALITOS_CCPSR_LO_MDTE 0x2000 /* master data transfer error */
246#define TALITOS_CCPSR_LO_SGDLZ 0x1000 /* s/g data len zero error */
247#define TALITOS_CCPSR_LO_FPZ 0x0800 /* fetch ptr zero error */
248#define TALITOS_CCPSR_LO_IDH 0x0400 /* illegal desc hdr error */
249#define TALITOS_CCPSR_LO_IEU 0x0200 /* invalid EU error */
250#define TALITOS_CCPSR_LO_EU 0x0100 /* EU error detected */
251#define TALITOS_CCPSR_LO_GB 0x0080 /* gather boundary error */
252#define TALITOS_CCPSR_LO_GRL 0x0040 /* gather return/length error */
253#define TALITOS_CCPSR_LO_SB 0x0020 /* scatter boundary error */
254#define TALITOS_CCPSR_LO_SRL 0x0010 /* scatter return/length error */
255
256/* channel fetch fifo register */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800257#define TALITOS_FF 0x48
258#define TALITOS_FF_LO 0x4c
Kim Phillips9c4a7962008-06-23 19:50:15 +0800259
260/* current descriptor pointer register */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800261#define TALITOS_CDPR 0x40
262#define TALITOS_CDPR_LO 0x44
Kim Phillips9c4a7962008-06-23 19:50:15 +0800263
264/* descriptor buffer register */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800265#define TALITOS_DESCBUF 0x80
266#define TALITOS_DESCBUF_LO 0x84
Kim Phillips9c4a7962008-06-23 19:50:15 +0800267
268/* gather link table */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800269#define TALITOS_GATHER 0xc0
270#define TALITOS_GATHER_LO 0xc4
Kim Phillips9c4a7962008-06-23 19:50:15 +0800271
272/* scatter link table */
Kim Phillipsad42d5f2011-11-21 16:13:27 +0800273#define TALITOS_SCATTER 0xe0
274#define TALITOS_SCATTER_LO 0xe4
Kim Phillips9c4a7962008-06-23 19:50:15 +0800275
LEROY Christophe5fa7fa12015-04-17 16:32:11 +0200276/* execution unit registers base */
277#define TALITOS2_DEU 0x2000
278#define TALITOS2_AESU 0x4000
279#define TALITOS2_MDEU 0x6000
280#define TALITOS2_AFEU 0x8000
281#define TALITOS2_RNGU 0xa000
282#define TALITOS2_PKEU 0xc000
283#define TALITOS2_KEU 0xe000
284#define TALITOS2_CRCU 0xf000
285
286#define TALITOS12_AESU 0x4000
287#define TALITOS12_DEU 0x5000
288#define TALITOS12_MDEU 0x6000
289
290#define TALITOS10_AFEU 0x8000
291#define TALITOS10_DEU 0xa000
292#define TALITOS10_MDEU 0xc000
293#define TALITOS10_RNGU 0xe000
294#define TALITOS10_PKEU 0x10000
295#define TALITOS10_AESU 0x12000
296
Kim Phillips9c4a7962008-06-23 19:50:15 +0800297/* execution unit interrupt status registers */
LEROY Christophe5fa7fa12015-04-17 16:32:11 +0200298#define TALITOS_EUDSR 0x10 /* data size */
299#define TALITOS_EUDSR_LO 0x14
300#define TALITOS_EURCR 0x18 /* reset control*/
301#define TALITOS_EURCR_LO 0x1c
302#define TALITOS_EUSR 0x28 /* rng status */
303#define TALITOS_EUSR_LO 0x2c
304#define TALITOS_EUISR 0x30
305#define TALITOS_EUISR_LO 0x34
306#define TALITOS_EUICR 0x38 /* int. control */
307#define TALITOS_EUICR_LO 0x3c
308#define TALITOS_EU_FIFO 0x800 /* output FIFO */
309#define TALITOS_EU_FIFO_LO 0x804 /* output FIFO */
LEROY Christophedd3c0982015-04-17 16:32:13 +0200310/* DES unit */
311#define TALITOS1_DEUICR_KPE 0x00200000 /* Key Parity Error */
LEROY Christophe5fa7fa12015-04-17 16:32:11 +0200312/* message digest unit */
Kim Phillipsfe5720e2008-10-12 20:33:14 +0800313#define TALITOS_MDEUICR_LO_ICE 0x4000 /* integrity check IRQ enable */
LEROY Christophe5fa7fa12015-04-17 16:32:11 +0200314/* random number unit */
Kim Phillips9c4a7962008-06-23 19:50:15 +0800315#define TALITOS_RNGUSR_LO_RD 0x1 /* reset done */
316#define TALITOS_RNGUSR_LO_OFL 0xff0000/* output FIFO length */
Kim Phillips9c4a7962008-06-23 19:50:15 +0800317#define TALITOS_RNGURCR_LO_SR 0x1 /* software reset */
Kim Phillips9c4a7962008-06-23 19:50:15 +0800318
Lee Nipper497f2e62010-05-19 19:20:36 +1000319#define TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256 0x28
320#define TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512 0x48
321
Kim Phillips9c4a7962008-06-23 19:50:15 +0800322/*
323 * talitos descriptor header (hdr) bits
324 */
325
326/* written back when done */
Harvey Harrisondad3df22008-11-28 20:49:19 +0800327#define DESC_HDR_DONE cpu_to_be32(0xff000000)
328#define DESC_HDR_LO_ICCR1_MASK cpu_to_be32(0x00180000)
329#define DESC_HDR_LO_ICCR1_PASS cpu_to_be32(0x00080000)
330#define DESC_HDR_LO_ICCR1_FAIL cpu_to_be32(0x00100000)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800331
332/* primary execution unit select */
Harvey Harrisondad3df22008-11-28 20:49:19 +0800333#define DESC_HDR_SEL0_MASK cpu_to_be32(0xf0000000)
334#define DESC_HDR_SEL0_AFEU cpu_to_be32(0x10000000)
335#define DESC_HDR_SEL0_DEU cpu_to_be32(0x20000000)
336#define DESC_HDR_SEL0_MDEUA cpu_to_be32(0x30000000)
337#define DESC_HDR_SEL0_MDEUB cpu_to_be32(0xb0000000)
338#define DESC_HDR_SEL0_RNG cpu_to_be32(0x40000000)
339#define DESC_HDR_SEL0_PKEU cpu_to_be32(0x50000000)
340#define DESC_HDR_SEL0_AESU cpu_to_be32(0x60000000)
341#define DESC_HDR_SEL0_KEU cpu_to_be32(0x70000000)
342#define DESC_HDR_SEL0_CRCU cpu_to_be32(0x80000000)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800343
344/* primary execution unit mode (MODE0) and derivatives */
Harvey Harrisondad3df22008-11-28 20:49:19 +0800345#define DESC_HDR_MODE0_ENCRYPT cpu_to_be32(0x00100000)
346#define DESC_HDR_MODE0_AESU_CBC cpu_to_be32(0x00200000)
347#define DESC_HDR_MODE0_DEU_CBC cpu_to_be32(0x00400000)
348#define DESC_HDR_MODE0_DEU_3DES cpu_to_be32(0x00200000)
Lee Nipper497f2e62010-05-19 19:20:36 +1000349#define DESC_HDR_MODE0_MDEU_CONT cpu_to_be32(0x08000000)
Harvey Harrisondad3df22008-11-28 20:49:19 +0800350#define DESC_HDR_MODE0_MDEU_INIT cpu_to_be32(0x01000000)
351#define DESC_HDR_MODE0_MDEU_HMAC cpu_to_be32(0x00800000)
352#define DESC_HDR_MODE0_MDEU_PAD cpu_to_be32(0x00400000)
Kim Phillips60f208d2010-05-19 19:21:53 +1000353#define DESC_HDR_MODE0_MDEU_SHA224 cpu_to_be32(0x00300000)
Harvey Harrisondad3df22008-11-28 20:49:19 +0800354#define DESC_HDR_MODE0_MDEU_MD5 cpu_to_be32(0x00200000)
355#define DESC_HDR_MODE0_MDEU_SHA256 cpu_to_be32(0x00100000)
356#define DESC_HDR_MODE0_MDEU_SHA1 cpu_to_be32(0x00000000)
Lee Nipper497f2e62010-05-19 19:20:36 +1000357#define DESC_HDR_MODE0_MDEUB_SHA384 cpu_to_be32(0x00000000)
358#define DESC_HDR_MODE0_MDEUB_SHA512 cpu_to_be32(0x00200000)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800359#define DESC_HDR_MODE0_MDEU_MD5_HMAC (DESC_HDR_MODE0_MDEU_MD5 | \
360 DESC_HDR_MODE0_MDEU_HMAC)
361#define DESC_HDR_MODE0_MDEU_SHA256_HMAC (DESC_HDR_MODE0_MDEU_SHA256 | \
362 DESC_HDR_MODE0_MDEU_HMAC)
363#define DESC_HDR_MODE0_MDEU_SHA1_HMAC (DESC_HDR_MODE0_MDEU_SHA1 | \
364 DESC_HDR_MODE0_MDEU_HMAC)
365
366/* secondary execution unit select (SEL1) */
Harvey Harrisondad3df22008-11-28 20:49:19 +0800367#define DESC_HDR_SEL1_MASK cpu_to_be32(0x000f0000)
368#define DESC_HDR_SEL1_MDEUA cpu_to_be32(0x00030000)
369#define DESC_HDR_SEL1_MDEUB cpu_to_be32(0x000b0000)
370#define DESC_HDR_SEL1_CRCU cpu_to_be32(0x00080000)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800371
372/* secondary execution unit mode (MODE1) and derivatives */
Harvey Harrisondad3df22008-11-28 20:49:19 +0800373#define DESC_HDR_MODE1_MDEU_CICV cpu_to_be32(0x00004000)
374#define DESC_HDR_MODE1_MDEU_INIT cpu_to_be32(0x00001000)
375#define DESC_HDR_MODE1_MDEU_HMAC cpu_to_be32(0x00000800)
376#define DESC_HDR_MODE1_MDEU_PAD cpu_to_be32(0x00000400)
Kim Phillips60f208d2010-05-19 19:21:53 +1000377#define DESC_HDR_MODE1_MDEU_SHA224 cpu_to_be32(0x00000300)
Harvey Harrisondad3df22008-11-28 20:49:19 +0800378#define DESC_HDR_MODE1_MDEU_MD5 cpu_to_be32(0x00000200)
379#define DESC_HDR_MODE1_MDEU_SHA256 cpu_to_be32(0x00000100)
380#define DESC_HDR_MODE1_MDEU_SHA1 cpu_to_be32(0x00000000)
Lee Nipper497f2e62010-05-19 19:20:36 +1000381#define DESC_HDR_MODE1_MDEUB_SHA384 cpu_to_be32(0x00000000)
382#define DESC_HDR_MODE1_MDEUB_SHA512 cpu_to_be32(0x00000200)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800383#define DESC_HDR_MODE1_MDEU_MD5_HMAC (DESC_HDR_MODE1_MDEU_MD5 | \
384 DESC_HDR_MODE1_MDEU_HMAC)
385#define DESC_HDR_MODE1_MDEU_SHA256_HMAC (DESC_HDR_MODE1_MDEU_SHA256 | \
386 DESC_HDR_MODE1_MDEU_HMAC)
387#define DESC_HDR_MODE1_MDEU_SHA1_HMAC (DESC_HDR_MODE1_MDEU_SHA1 | \
388 DESC_HDR_MODE1_MDEU_HMAC)
Horia Geanta357fb602012-07-03 19:16:53 +0300389#define DESC_HDR_MODE1_MDEU_SHA224_HMAC (DESC_HDR_MODE1_MDEU_SHA224 | \
390 DESC_HDR_MODE1_MDEU_HMAC)
391#define DESC_HDR_MODE1_MDEUB_SHA384_HMAC (DESC_HDR_MODE1_MDEUB_SHA384 | \
392 DESC_HDR_MODE1_MDEU_HMAC)
393#define DESC_HDR_MODE1_MDEUB_SHA512_HMAC (DESC_HDR_MODE1_MDEUB_SHA512 | \
394 DESC_HDR_MODE1_MDEU_HMAC)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800395
396/* direction of overall data flow (DIR) */
Harvey Harrisondad3df22008-11-28 20:49:19 +0800397#define DESC_HDR_DIR_INBOUND cpu_to_be32(0x00000002)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800398
399/* request done notification (DN) */
Harvey Harrisondad3df22008-11-28 20:49:19 +0800400#define DESC_HDR_DONE_NOTIFY cpu_to_be32(0x00000001)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800401
402/* descriptor types */
Harvey Harrisondad3df22008-11-28 20:49:19 +0800403#define DESC_HDR_TYPE_AESU_CTR_NONSNOOP cpu_to_be32(0 << 3)
404#define DESC_HDR_TYPE_IPSEC_ESP cpu_to_be32(1 << 3)
405#define DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU cpu_to_be32(2 << 3)
406#define DESC_HDR_TYPE_HMAC_SNOOP_NO_AFEU cpu_to_be32(4 << 3)
Kim Phillips9c4a7962008-06-23 19:50:15 +0800407
408/* link table extent field bits */
409#define DESC_PTR_LNKTBL_JUMP 0x80
410#define DESC_PTR_LNKTBL_RETURN 0x02
411#define DESC_PTR_LNKTBL_NEXT 0x01