diff options
author | Horia Geanta <horia.geanta@freescale.com> | 2012-07-03 12:16:51 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2012-07-10 23:08:29 -0400 |
commit | d1a0eb98e7a8b7e244e31430fdb1a752243e2698 (patch) | |
tree | 511f20120f7a618d8de4e690c48ad0e8bcf916a4 /drivers/crypto/talitos.c | |
parent | de197533485c09598215802b0e401a688e172573 (diff) |
crypto: talitos - move talitos structures to header file
This patch moves the talitos structure definitions from c file to its
header file so that the same can be shared on need basis.
Signed-off-by: Sandeep Malik <Sandeep.Malik@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/talitos.c')
-rw-r--r-- | drivers/crypto/talitos.c | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 921039e56f87..bb3e63f5596b 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
@@ -53,117 +53,6 @@ | |||
53 | 53 | ||
54 | #include "talitos.h" | 54 | #include "talitos.h" |
55 | 55 | ||
56 | #define TALITOS_TIMEOUT 100000 | ||
57 | #define TALITOS_MAX_DATA_LEN 65535 | ||
58 | |||
59 | #define DESC_TYPE(desc_hdr) ((be32_to_cpu(desc_hdr) >> 3) & 0x1f) | ||
60 | #define PRIMARY_EU(desc_hdr) ((be32_to_cpu(desc_hdr) >> 28) & 0xf) | ||
61 | #define SECONDARY_EU(desc_hdr) ((be32_to_cpu(desc_hdr) >> 16) & 0xf) | ||
62 | |||
63 | /* descriptor pointer entry */ | ||
64 | struct talitos_ptr { | ||
65 | __be16 len; /* length */ | ||
66 | u8 j_extent; /* jump to sg link table and/or extent */ | ||
67 | u8 eptr; /* extended address */ | ||
68 | __be32 ptr; /* address */ | ||
69 | }; | ||
70 | |||
71 | static const struct talitos_ptr zero_entry = { | ||
72 | .len = 0, | ||
73 | .j_extent = 0, | ||
74 | .eptr = 0, | ||
75 | .ptr = 0 | ||
76 | }; | ||
77 | |||
78 | /* descriptor */ | ||
79 | struct talitos_desc { | ||
80 | __be32 hdr; /* header high bits */ | ||
81 | __be32 hdr_lo; /* header low bits */ | ||
82 | struct talitos_ptr ptr[7]; /* ptr/len pair array */ | ||
83 | }; | ||
84 | |||
85 | /** | ||
86 | * talitos_request - descriptor submission request | ||
87 | * @desc: descriptor pointer (kernel virtual) | ||
88 | * @dma_desc: descriptor's physical bus address | ||
89 | * @callback: whom to call when descriptor processing is done | ||
90 | * @context: caller context (optional) | ||
91 | */ | ||
92 | struct talitos_request { | ||
93 | struct talitos_desc *desc; | ||
94 | dma_addr_t dma_desc; | ||
95 | void (*callback) (struct device *dev, struct talitos_desc *desc, | ||
96 | void *context, int error); | ||
97 | void *context; | ||
98 | }; | ||
99 | |||
100 | /* per-channel fifo management */ | ||
101 | struct talitos_channel { | ||
102 | void __iomem *reg; | ||
103 | |||
104 | /* request fifo */ | ||
105 | struct talitos_request *fifo; | ||
106 | |||
107 | /* number of requests pending in channel h/w fifo */ | ||
108 | atomic_t submit_count ____cacheline_aligned; | ||
109 | |||
110 | /* request submission (head) lock */ | ||
111 | spinlock_t head_lock ____cacheline_aligned; | ||
112 | /* index to next free descriptor request */ | ||
113 | int head; | ||
114 | |||
115 | /* request release (tail) lock */ | ||
116 | spinlock_t tail_lock ____cacheline_aligned; | ||
117 | /* index to next in-progress/done descriptor request */ | ||
118 | int tail; | ||
119 | }; | ||
120 | |||
121 | struct talitos_private { | ||
122 | struct device *dev; | ||
123 | struct platform_device *ofdev; | ||
124 | void __iomem *reg; | ||
125 | int irq[2]; | ||
126 | |||
127 | /* SEC global registers lock */ | ||
128 | spinlock_t reg_lock ____cacheline_aligned; | ||
129 | |||
130 | /* SEC version geometry (from device tree node) */ | ||
131 | unsigned int num_channels; | ||
132 | unsigned int chfifo_len; | ||
133 | unsigned int exec_units; | ||
134 | unsigned int desc_types; | ||
135 | |||
136 | /* SEC Compatibility info */ | ||
137 | unsigned long features; | ||
138 | |||
139 | /* | ||
140 | * length of the request fifo | ||
141 | * fifo_len is chfifo_len rounded up to next power of 2 | ||
142 | * so we can use bitwise ops to wrap | ||
143 | */ | ||
144 | unsigned int fifo_len; | ||
145 | |||
146 | struct talitos_channel *chan; | ||
147 | |||
148 | /* next channel to be assigned next incoming descriptor */ | ||
149 | atomic_t last_chan ____cacheline_aligned; | ||
150 | |||
151 | /* request callback tasklet */ | ||
152 | struct tasklet_struct done_task[2]; | ||
153 | |||
154 | /* list of registered algorithms */ | ||
155 | struct list_head alg_list; | ||
156 | |||
157 | /* hwrng device */ | ||
158 | struct hwrng rng; | ||
159 | }; | ||
160 | |||
161 | /* .features flag */ | ||
162 | #define TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT 0x00000001 | ||
163 | #define TALITOS_FTR_HW_AUTH_CHECK 0x00000002 | ||
164 | #define TALITOS_FTR_SHA224_HWINIT 0x00000004 | ||
165 | #define TALITOS_FTR_HMAC_OK 0x00000008 | ||
166 | |||
167 | static void to_talitos_ptr(struct talitos_ptr *talitos_ptr, dma_addr_t dma_addr) | 56 | static void to_talitos_ptr(struct talitos_ptr *talitos_ptr, dma_addr_t dma_addr) |
168 | { | 57 | { |
169 | talitos_ptr->ptr = cpu_to_be32(lower_32_bits(dma_addr)); | 58 | talitos_ptr->ptr = cpu_to_be32(lower_32_bits(dma_addr)); |