hifn7751reg.h revision 1.1 1 1.1 itojun /* $NetBSD: hifn7751reg.h,v 1.1 2000/10/12 02:59:59 itojun Exp $ */
2 1.1 itojun /* $OpenBSD: hifn7751reg.h,v 1.15 2000/09/21 13:34:58 jason Exp $ */
3 1.1 itojun
4 1.1 itojun /*
5 1.1 itojun * Invertex AEON / Hi/fn 7751 driver
6 1.1 itojun * Copyright (c) 1999 Invertex Inc. All rights reserved.
7 1.1 itojun * Copyright (c) 1999 Theo de Raadt
8 1.1 itojun * Copyright (c) 2000 Network Security Technologies, Inc.
9 1.1 itojun * http://www.netsec.net
10 1.1 itojun *
11 1.1 itojun * Please send any comments, feedback, bug-fixes, or feature requests to
12 1.1 itojun * software (at) invertex.com.
13 1.1 itojun *
14 1.1 itojun * Redistribution and use in source and binary forms, with or without
15 1.1 itojun * modification, are permitted provided that the following conditions
16 1.1 itojun * are met:
17 1.1 itojun *
18 1.1 itojun * 1. Redistributions of source code must retain the above copyright
19 1.1 itojun * notice, this list of conditions and the following disclaimer.
20 1.1 itojun * 2. Redistributions in binary form must reproduce the above copyright
21 1.1 itojun * notice, this list of conditions and the following disclaimer in the
22 1.1 itojun * documentation and/or other materials provided with the distribution.
23 1.1 itojun * 3. The name of the author may not be used to endorse or promote products
24 1.1 itojun * derived from this software without specific prior written permission.
25 1.1 itojun *
26 1.1 itojun *
27 1.1 itojun * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28 1.1 itojun * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 1.1 itojun * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 1.1 itojun * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31 1.1 itojun * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 1.1 itojun * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 1.1 itojun * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 1.1 itojun * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 1.1 itojun * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 1.1 itojun * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 1.1 itojun */
38 1.1 itojun #ifndef __DEV_PCI_HIFN7751REG_H__
39 1.1 itojun #define __DEV_PCI_HIFN7751REG_H__
40 1.1 itojun
41 1.1 itojun #include <machine/endian.h>
42 1.1 itojun
43 1.1 itojun /*
44 1.1 itojun * Some PCI configuration space offset defines. The names were made
45 1.1 itojun * identical to the names used by the Linux kernel.
46 1.1 itojun */
47 1.1 itojun #define HIFN_BAR0 (PCI_MAPREG_START + 0) /* PUC register map */
48 1.1 itojun #define HIFN_BAR1 (PCI_MAPREG_START + 4) /* DMA register map */
49 1.1 itojun
50 1.1 itojun /*
51 1.1 itojun * Some configurable values for the driver
52 1.1 itojun */
53 1.1 itojun #define HIFN_D_CMD_RSIZE 24
54 1.1 itojun #define HIFN_D_SRC_RSIZE 80
55 1.1 itojun #define HIFN_D_DST_RSIZE 80
56 1.1 itojun #define HIFN_D_RES_RSIZE 24
57 1.1 itojun
58 1.1 itojun /*
59 1.1 itojun * The values below should multiple of 4 -- and be large enough to handle
60 1.1 itojun * any command the driver implements.
61 1.1 itojun *
62 1.1 itojun * MAX_COMMAND = base command + mac command + encrypt command +
63 1.1 itojun * mac-key + des-iv + 3des-key
64 1.1 itojun * MAX_RESULT = base result + mac result + mac + encrypt result
65 1.1 itojun *
66 1.1 itojun *
67 1.1 itojun */
68 1.1 itojun #define HIFN_MAX_COMMAND (8 + 8 + 8 + 64 + 8 + 24)
69 1.1 itojun #define HIFN_MAX_RESULT (8 + 4 + 20 + 4)
70 1.1 itojun
71 1.1 itojun /*
72 1.1 itojun * hifn_desc_t
73 1.1 itojun *
74 1.1 itojun * Holds an individual descriptor for any of the rings.
75 1.1 itojun */
76 1.1 itojun typedef struct hifn_desc {
77 1.1 itojun volatile u_int32_t l; /* length and status bits */
78 1.1 itojun volatile u_int32_t p;
79 1.1 itojun } hifn_desc_t;
80 1.1 itojun
81 1.1 itojun /*
82 1.1 itojun * Masks for the "length" field of struct hifn_desc.
83 1.1 itojun */
84 1.1 itojun #define HIFN_D_LENGTH 0x0000ffff /* length bit mask */
85 1.1 itojun #define HIFN_D_MASKDONEIRQ 0x02000000 /* mask the done interrupt */
86 1.1 itojun #define HIFN_D_DESTOVER 0x04000000 /* destination overflow */
87 1.1 itojun #define HIFN_D_OVER 0x08000000 /* overflow */
88 1.1 itojun #define HIFN_D_LAST 0x20000000 /* last descriptor in chain */
89 1.1 itojun #define HIFN_D_JUMP 0x40000000 /* jump descriptor */
90 1.1 itojun #define HIFN_D_VALID 0x80000000 /* valid bit */
91 1.1 itojun
92 1.1 itojun /*
93 1.1 itojun * hifn_callback_t
94 1.1 itojun *
95 1.1 itojun * Type for callback function when dest data is ready.
96 1.1 itojun */
97 1.1 itojun typedef void (*hifn_callback_t)(hifn_command_t *);
98 1.1 itojun
99 1.1 itojun /*
100 1.1 itojun * Data structure to hold all 4 rings and any other ring related data.
101 1.1 itojun */
102 1.1 itojun struct hifn_dma {
103 1.1 itojun /*
104 1.1 itojun * Descriptor rings. We add +1 to the size to accomidate the
105 1.1 itojun * jump descriptor.
106 1.1 itojun */
107 1.1 itojun struct hifn_desc cmdr[HIFN_D_CMD_RSIZE+1];
108 1.1 itojun struct hifn_desc srcr[HIFN_D_SRC_RSIZE+1];
109 1.1 itojun struct hifn_desc dstr[HIFN_D_DST_RSIZE+1];
110 1.1 itojun struct hifn_desc resr[HIFN_D_RES_RSIZE+1];
111 1.1 itojun
112 1.1 itojun struct hifn_command *hifn_commands[HIFN_D_RES_RSIZE];
113 1.1 itojun
114 1.1 itojun u_char command_bufs[HIFN_D_CMD_RSIZE][HIFN_MAX_COMMAND];
115 1.1 itojun u_char result_bufs[HIFN_D_CMD_RSIZE][HIFN_MAX_RESULT];
116 1.1 itojun
117 1.1 itojun /*
118 1.1 itojun * Our current positions for insertion and removal from the desriptor
119 1.1 itojun * rings.
120 1.1 itojun */
121 1.1 itojun int cmdi, srci, dsti, resi;
122 1.1 itojun volatile int cmdu, srcu, dstu, resu;
123 1.1 itojun int cmdk, srck, dstk, resk;
124 1.1 itojun };
125 1.1 itojun
126 1.1 itojun struct hifn_session {
127 1.1 itojun int hs_flags;
128 1.1 itojun u_int8_t hs_iv[HIFN_IV_LENGTH];
129 1.1 itojun };
130 1.1 itojun
131 1.1 itojun /*
132 1.1 itojun * Holds data specific to a single HIFN board.
133 1.1 itojun */
134 1.1 itojun struct hifn_softc {
135 1.1 itojun struct device sc_dv; /* generic device */
136 1.1 itojun void * sc_ih; /* interrupt handler cookie */
137 1.1 itojun u_int32_t sc_drammodel; /* 1=dram, 0=sram */
138 1.1 itojun
139 1.1 itojun bus_space_handle_t sc_sh0, sc_sh1;
140 1.1 itojun bus_space_tag_t sc_st0, sc_st1;
141 1.1 itojun bus_dma_tag_t sc_dmat;
142 1.1 itojun
143 1.1 itojun struct hifn_dma *sc_dma;
144 1.1 itojun int32_t sc_cid;
145 1.1 itojun int sc_maxses;
146 1.1 itojun int sc_ramsize;
147 1.1 itojun struct hifn_session sc_sessions[2048];
148 1.1 itojun };
149 1.1 itojun
150 1.1 itojun /*
151 1.1 itojun * Processing Unit Registers (offset from BASEREG0)
152 1.1 itojun */
153 1.1 itojun #define HIFN_0_PUDATA 0x00 /* Processing Unit Data */
154 1.1 itojun #define HIFN_0_PUCTRL 0x04 /* Processing Unit Control */
155 1.1 itojun #define HIFN_0_PUISR 0x08 /* Processing Unit Interrupt Status */
156 1.1 itojun #define HIFN_0_PUCNFG 0x0c /* Processing Unit Configuration */
157 1.1 itojun #define HIFN_0_PUIER 0x10 /* Processing Unit Interrupt Enable */
158 1.1 itojun #define HIFN_0_PUSTAT 0x14 /* Processing Unit Status/Chip ID */
159 1.1 itojun #define HIFN_0_FIFOSTAT 0x18 /* FIFO Status */
160 1.1 itojun #define HIFN_0_FIFOCNFG 0x1c /* FIFO Configuration */
161 1.1 itojun #define HIFN_0_SPACESIZE 0x20 /* Register space size */
162 1.1 itojun
163 1.1 itojun /* Processing Unit Control Register (HIFN_0_PUCTRL) */
164 1.1 itojun #define HIFN_PUCTRL_CLRSRCFIFO 0x0010 /* clear source fifo */
165 1.1 itojun #define HIFN_PUCTRL_STOP 0x0008 /* stop pu */
166 1.1 itojun #define HIFN_PUCTRL_LOCKRAM 0x0004 /* lock ram */
167 1.1 itojun #define HIFN_PUCTRL_DMAENA 0x0002 /* enable dma */
168 1.1 itojun #define HIFN_PUCTRL_RESET 0x0001 /* Reset processing unit */
169 1.1 itojun
170 1.1 itojun /* Processing Unit Interrupt Status Register (HIFN_0_PUISR) */
171 1.1 itojun #define HIFN_PUISR_CMDINVAL 0x8000 /* Invalid command interrupt */
172 1.1 itojun #define HIFN_PUISR_DATAERR 0x4000 /* Data error interrupt */
173 1.1 itojun #define HIFN_PUISR_SRCFIFO 0x2000 /* Source FIFO ready interrupt */
174 1.1 itojun #define HIFN_PUISR_DSTFIFO 0x1000 /* Destination FIFO ready interrupt */
175 1.1 itojun #define HIFN_PUISR_DSTOVER 0x0200 /* Destination overrun interrupt */
176 1.1 itojun #define HIFN_PUISR_SRCCMD 0x0080 /* Source command interrupt */
177 1.1 itojun #define HIFN_PUISR_SRCCTX 0x0040 /* Source context interrupt */
178 1.1 itojun #define HIFN_PUISR_SRCDATA 0x0020 /* Source data interrupt */
179 1.1 itojun #define HIFN_PUISR_DSTDATA 0x0010 /* Destination data interrupt */
180 1.1 itojun #define HIFN_PUISR_DSTRESULT 0x0004 /* Destination result interrupt */
181 1.1 itojun
182 1.1 itojun /* Processing Unit Configuration Register (HIFN_0_PUCNFG) */
183 1.1 itojun #define HIFN_PUCNFG_DRAMMASK 0xe000 /* DRAM size mask */
184 1.1 itojun #define HIFN_PUCNFG_DSZ_256K 0x0000 /* 256k dram */
185 1.1 itojun #define HIFN_PUCNFG_DSZ_512K 0x2000 /* 512k dram */
186 1.1 itojun #define HIFN_PUCNFG_DSZ_1M 0x4000 /* 1m dram */
187 1.1 itojun #define HIFN_PUCNFG_DSZ_2M 0x6000 /* 2m dram */
188 1.1 itojun #define HIFN_PUCNFG_DSZ_4M 0x8000 /* 4m dram */
189 1.1 itojun #define HIFN_PUCNFG_DSZ_8M 0xa000 /* 8m dram */
190 1.1 itojun #define HIFN_PUNCFG_DSZ_16M 0xc000 /* 16m dram */
191 1.1 itojun #define HIFN_PUCNFG_DSZ_32M 0xe000 /* 32m dram */
192 1.1 itojun #define HIFN_PUCNFG_DRAMREFRESH 0x1800 /* DRAM refresh rate mask */
193 1.1 itojun #define HIFN_PUCNFG_DRFR_512 0x0000 /* 512 divisor of ECLK */
194 1.1 itojun #define HIFN_PUCNFG_DRFR_256 0x0800 /* 256 divisor of ECLK */
195 1.1 itojun #define HIFN_PUCNFG_DRFR_128 0x1000 /* 128 divisor of ECLK */
196 1.1 itojun #define HIFN_PUCNFG_TCALLPHASES 0x0200 /* your guess is as good as mine... */
197 1.1 itojun #define HIFN_PUCNFG_TCDRVTOTEM 0x0100 /* your guess is as good as mine... */
198 1.1 itojun #define HIFN_PUCNFG_BIGENDIAN 0x0080 /* DMA big endian mode */
199 1.1 itojun #define HIFN_PUCNFG_BUS32 0x0040 /* Bus width 32bits */
200 1.1 itojun #define HIFN_PUCNFG_BUS16 0x0000 /* Bus width 16 bits */
201 1.1 itojun #define HIFN_PUCNFG_CHIPID 0x0020 /* Allow chipid from PUSTAT */
202 1.1 itojun #define HIFN_PUCNFG_DRAM 0x0010 /* Context RAM is DRAM */
203 1.1 itojun #define HIFN_PUCNFG_SRAM 0x0000 /* Context RAM is SRAM */
204 1.1 itojun #define HIFN_PUCNFG_COMPSING 0x0004 /* Enable single compression context */
205 1.1 itojun #define HIFN_PUCNFG_ENCCNFG 0x0002 /* Encryption configuration */
206 1.1 itojun
207 1.1 itojun /* Processing Unit Interrupt Enable Register (HIFN_0_PUIER) */
208 1.1 itojun #define HIFN_PUIER_CMDINVAL 0x8000 /* Invalid command interrupt */
209 1.1 itojun #define HIFN_PUIER_DATAERR 0x4000 /* Data error interrupt */
210 1.1 itojun #define HIFN_PUIER_SRCFIFO 0x2000 /* Source FIFO ready interrupt */
211 1.1 itojun #define HIFN_PUIER_DSTFIFO 0x1000 /* Destination FIFO ready interrupt */
212 1.1 itojun #define HIFN_PUIER_DSTOVER 0x0200 /* Destination overrun interrupt */
213 1.1 itojun #define HIFN_PUIER_SRCCMD 0x0080 /* Source command interrupt */
214 1.1 itojun #define HIFN_PUIER_SRCCTX 0x0040 /* Source context interrupt */
215 1.1 itojun #define HIFN_PUIER_SRCDATA 0x0020 /* Source data interrupt */
216 1.1 itojun #define HIFN_PUIER_DSTDATA 0x0010 /* Destination data interrupt */
217 1.1 itojun #define HIFN_PUIER_DSTRESULT 0x0004 /* Destination result interrupt */
218 1.1 itojun
219 1.1 itojun /* Processing Unit Status Register/Chip ID (HIFN_0_PUSTAT) */
220 1.1 itojun #define HIFN_PUSTAT_CMDINVAL 0x8000 /* Invalid command interrupt */
221 1.1 itojun #define HIFN_PUSTAT_DATAERR 0x4000 /* Data error interrupt */
222 1.1 itojun #define HIFN_PUSTAT_SRCFIFO 0x2000 /* Source FIFO ready interrupt */
223 1.1 itojun #define HIFN_PUSTAT_DSTFIFO 0x1000 /* Destination FIFO ready interrupt */
224 1.1 itojun #define HIFN_PUSTAT_DSTOVER 0x0200 /* Destination overrun interrupt */
225 1.1 itojun #define HIFN_PUSTAT_SRCCMD 0x0080 /* Source command interrupt */
226 1.1 itojun #define HIFN_PUSTAT_SRCCTX 0x0040 /* Source context interrupt */
227 1.1 itojun #define HIFN_PUSTAT_SRCDATA 0x0020 /* Source data interrupt */
228 1.1 itojun #define HIFN_PUSTAT_DSTDATA 0x0010 /* Destination data interrupt */
229 1.1 itojun #define HIFN_PUSTAT_DSTRESULT 0x0004 /* Destination result interrupt */
230 1.1 itojun #define HIFN_PUSTAT_CHIPREV 0x00ff /* Chip revision mask */
231 1.1 itojun #define HIFN_PUSTAT_CHIPENA 0xff00 /* Chip enabled mask */
232 1.1 itojun #define HIFN_PUSTAT_ENA_2 0x1100 /* Level 2 enabled */
233 1.1 itojun #define HIFN_PUSTAT_ENA_1 0x1000 /* Level 1 enabled */
234 1.1 itojun #define HIFN_PUSTAT_ENA_0 0x3000 /* Level 0 enabled */
235 1.1 itojun #define HIFN_PUSTAT_REV_2 0x0020 /* 7751 PT6/2 */
236 1.1 itojun #define HIFN_PUSTAT_REV_3 0x0030 /* 7751 PT6/3 */
237 1.1 itojun
238 1.1 itojun /* FIFO Status Register (HIFN_0_FIFOSTAT) */
239 1.1 itojun #define HIFN_FIFOSTAT_SRC 0x7f00 /* Source FIFO available */
240 1.1 itojun #define HIFN_FIFOSTAT_DST 0x007f /* Destination FIFO available */
241 1.1 itojun
242 1.1 itojun /* FIFO Configuration Register (HIFN_0_FIFOCNFG) */
243 1.1 itojun #define HIFN_FIFOCNFG_THRESHOLD 0x0400 /* must be written as 1 */
244 1.1 itojun
245 1.1 itojun /*
246 1.1 itojun * DMA Interface Registers (offset from BASEREG1)
247 1.1 itojun */
248 1.1 itojun #define HIFN_1_DMA_CRAR 0x0c /* DMA Command Ring Address */
249 1.1 itojun #define HIFN_1_DMA_SRAR 0x1c /* DMA Source Ring Address */
250 1.1 itojun #define HIFN_1_DMA_RRAR 0x2c /* DMA Resultt Ring Address */
251 1.1 itojun #define HIFN_1_DMA_DRAR 0x3c /* DMA Destination Ring Address */
252 1.1 itojun #define HIFN_1_DMA_CSR 0x40 /* DMA Status and Control */
253 1.1 itojun #define HIFN_1_DMA_IER 0x44 /* DMA Interrupt Enable */
254 1.1 itojun #define HIFN_1_DMA_CNFG 0x48 /* DMA Configuration */
255 1.1 itojun #define HIFN_1_REVID 0x98 /* Revision ID */
256 1.1 itojun
257 1.1 itojun /* DMA Status and Control Register (HIFN_1_DMA_CSR) */
258 1.1 itojun #define HIFN_DMACSR_D_CTRLMASK 0xc0000000 /* Destinition Ring Control */
259 1.1 itojun #define HIFN_DMACSR_D_CTRL_NOP 0x00000000 /* Dest. Control: no-op */
260 1.1 itojun #define HIFN_DMACSR_D_CTRL_DIS 0x40000000 /* Dest. Control: disable */
261 1.1 itojun #define HIFN_DMACSR_D_CTRL_ENA 0x80000000 /* Dest. Control: enable */
262 1.1 itojun #define HIFN_DMACSR_D_ABORT 0x20000000 /* Destinition Ring PCIAbort */
263 1.1 itojun #define HIFN_DMACSR_D_DONE 0x10000000 /* Destinition Ring Done */
264 1.1 itojun #define HIFN_DMACSR_D_LAST 0x08000000 /* Destinition Ring Last */
265 1.1 itojun #define HIFN_DMACSR_D_WAIT 0x04000000 /* Destinition Ring Waiting */
266 1.1 itojun #define HIFN_DMACSR_D_OVER 0x02000000 /* Destinition Ring Overflow */
267 1.1 itojun #define HIFN_DMACSR_R_CTRL 0x00c00000 /* Result Ring Control */
268 1.1 itojun #define HIFN_DMACSR_R_CTRL_NOP 0x00000000 /* Result Control: no-op */
269 1.1 itojun #define HIFN_DMACSR_R_CTRL_DIS 0x00400000 /* Result Control: disable */
270 1.1 itojun #define HIFN_DMACSR_R_CTRL_ENA 0x00800000 /* Result Control: enable */
271 1.1 itojun #define HIFN_DMACSR_R_ABORT 0x00200000 /* Result Ring PCI Abort */
272 1.1 itojun #define HIFN_DMACSR_R_DONE 0x00100000 /* Result Ring Done */
273 1.1 itojun #define HIFN_DMACSR_R_LAST 0x00080000 /* Result Ring Last */
274 1.1 itojun #define HIFN_DMACSR_R_WAIT 0x00040000 /* Result Ring Waiting */
275 1.1 itojun #define HIFN_DMACSR_R_OVER 0x00020000 /* Result Ring Overflow */
276 1.1 itojun #define HIFN_DMACSR_S_CTRL 0x0000c000 /* Source Ring Control */
277 1.1 itojun #define HIFN_DMACSR_S_CTRL_NOP 0x00000000 /* Source Control: no-op */
278 1.1 itojun #define HIFN_DMACSR_S_CTRL_DIS 0x00004000 /* Source Control: disable */
279 1.1 itojun #define HIFN_DMACSR_S_CTRL_ENA 0x00008000 /* Source Control: enable */
280 1.1 itojun #define HIFN_DMACSR_S_ABORT 0x00002000 /* Source Ring PCI Abort */
281 1.1 itojun #define HIFN_DMACSR_S_DONE 0x00001000 /* Source Ring Done */
282 1.1 itojun #define HIFN_DMACSR_S_LAST 0x00000800 /* Source Ring Last */
283 1.1 itojun #define HIFN_DMACSR_S_WAIT 0x00000400 /* Source Ring Waiting */
284 1.1 itojun #define HIFN_DMACSR_S_OVER 0x00000200 /* Source Ring Overflow */
285 1.1 itojun #define HIFN_DMACSR_C_CTRL 0x000000c0 /* Command Ring Control */
286 1.1 itojun #define HIFN_DMACSR_C_CTRL_NOP 0x00000000 /* Command Control: no-op */
287 1.1 itojun #define HIFN_DMACSR_C_CTRL_DIS 0x00000040 /* Command Control: disable */
288 1.1 itojun #define HIFN_DMACSR_C_CTRL_ENA 0x00000080 /* Command Control: enable */
289 1.1 itojun #define HIFN_DMACSR_C_ABORT 0x00000020 /* Command Ring PCI Abort */
290 1.1 itojun #define HIFN_DMACSR_C_DONE 0x00000010 /* Command Ring Done */
291 1.1 itojun #define HIFN_DMACSR_C_LAST 0x00000008 /* Command Ring Last */
292 1.1 itojun #define HIFN_DMACSR_C_WAIT 0x00000004 /* Command Ring Waiting */
293 1.1 itojun #define HIFN_DMACSR_C_EIRQ 0x00000001 /* Command Ring Engine IRQ */
294 1.1 itojun
295 1.1 itojun /* DMA Interrupt Enable Register (HIFN_1_DMA_IER) */
296 1.1 itojun #define HIFN_DMAIER_D_ABORT 0x20000000 /* Destination Ring PCIAbort */
297 1.1 itojun #define HIFN_DMAIER_D_DONE 0x10000000 /* Destination Ring Done */
298 1.1 itojun #define HIFN_DMAIER_D_LAST 0x08000000 /* Destination Ring Last */
299 1.1 itojun #define HIFN_DMAIER_D_WAIT 0x04000000 /* Destination Ring Waiting */
300 1.1 itojun #define HIFN_DMAIER_D_OVER 0x02000000 /* Destination Ring Overflow */
301 1.1 itojun #define HIFN_DMAIER_R_ABORT 0x00200000 /* Result Ring PCI Abort */
302 1.1 itojun #define HIFN_DMAIER_R_DONE 0x00100000 /* Result Ring Done */
303 1.1 itojun #define HIFN_DMAIER_R_LAST 0x00080000 /* Result Ring Last */
304 1.1 itojun #define HIFN_DMAIER_R_WAIT 0x00040000 /* Result Ring Waiting */
305 1.1 itojun #define HIFN_DMAIER_R_OVER 0x00020000 /* Result Ring Overflow */
306 1.1 itojun #define HIFN_DMAIER_S_ABORT 0x00002000 /* Source Ring PCI Abort */
307 1.1 itojun #define HIFN_DMAIER_S_DONE 0x00001000 /* Source Ring Done */
308 1.1 itojun #define HIFN_DMAIER_S_LAST 0x00000800 /* Source Ring Last */
309 1.1 itojun #define HIFN_DMAIER_S_WAIT 0x00000400 /* Source Ring Waiting */
310 1.1 itojun #define HIFN_DMAIER_S_OVER 0x00000200 /* Source Ring Overflow */
311 1.1 itojun #define HIFN_DMAIER_C_ABORT 0x00000020 /* Command Ring PCI Abort */
312 1.1 itojun #define HIFN_DMAIER_C_DONE 0x00000010 /* Command Ring Done */
313 1.1 itojun #define HIFN_DMAIER_C_LAST 0x00000008 /* Command Ring Last */
314 1.1 itojun #define HIFN_DMAIER_C_WAIT 0x00000004 /* Command Ring Waiting */
315 1.1 itojun #define HIFN_DMAIER_ENGINE 0x00000001 /* Engine IRQ */
316 1.1 itojun
317 1.1 itojun /* DMA Configuration Register (HIFN_1_DMA_CNFG) */
318 1.1 itojun #define HIFN_DMACNFG_BIGENDIAN 0x10000000 /* big endian mode */
319 1.1 itojun #define HIFN_DMACNFG_POLLFREQ 0x00ff0000 /* Poll frequency mask */
320 1.1 itojun #define HIFN_DMACNFG_UNLOCK 0x00000800
321 1.1 itojun #define HIFN_DMACNFG_POLLINVAL 0x00000700 /* Invalid Poll Scalar */
322 1.1 itojun #define HIFN_DMACNFG_LAST 0x00000010 /* Host control LAST bit */
323 1.1 itojun #define HIFN_DMACNFG_MODE 0x00000004 /* DMA mode */
324 1.1 itojun #define HIFN_DMACNFG_DMARESET 0x00000002 /* DMA Reset # */
325 1.1 itojun #define HIFN_DMACNFG_MSTRESET 0x00000001 /* Master Reset # */
326 1.1 itojun
327 1.1 itojun #define WRITE_REG_0(sc,reg,val) \
328 1.1 itojun bus_space_write_4((sc)->sc_st0, (sc)->sc_sh0, reg, val)
329 1.1 itojun #define READ_REG_0(sc,reg) \
330 1.1 itojun bus_space_read_4((sc)->sc_st0, (sc)->sc_sh0, reg)
331 1.1 itojun
332 1.1 itojun /*
333 1.1 itojun * Register offsets in register set 1
334 1.1 itojun */
335 1.1 itojun
336 1.1 itojun #define HIFN_UNLOCK_SECRET1 0xf4
337 1.1 itojun #define HIFN_UNLOCK_SECRET2 0xfc
338 1.1 itojun
339 1.1 itojun #define WRITE_REG_1(sc,reg,val) \
340 1.1 itojun bus_space_write_4((sc)->sc_st1, (sc)->sc_sh1, reg, val)
341 1.1 itojun #define READ_REG_1(sc,reg) \
342 1.1 itojun bus_space_read_4((sc)->sc_st1, (sc)->sc_sh1, reg)
343 1.1 itojun
344 1.1 itojun /*********************************************************************
345 1.1 itojun * Structs for board commands
346 1.1 itojun *
347 1.1 itojun *********************************************************************/
348 1.1 itojun
349 1.1 itojun /*
350 1.1 itojun * Structure to help build up the command data structure.
351 1.1 itojun */
352 1.1 itojun typedef struct hifn_base_command {
353 1.1 itojun volatile u_int16_t masks;
354 1.1 itojun volatile u_int16_t session_num;
355 1.1 itojun volatile u_int16_t total_source_count;
356 1.1 itojun volatile u_int16_t total_dest_count;
357 1.1 itojun } hifn_base_command_t;
358 1.1 itojun
359 1.1 itojun #define HIFN_BASE_CMD_MAC (0x1 << 10)
360 1.1 itojun #define HIFN_BASE_CMD_CRYPT (0x1 << 11)
361 1.1 itojun #define HIFN_BASE_CMD_DECODE (0x1 << 13)
362 1.1 itojun
363 1.1 itojun /*
364 1.1 itojun * Structure to help build up the command data structure.
365 1.1 itojun */
366 1.1 itojun typedef struct hifn_crypt_command {
367 1.1 itojun volatile u_int16_t masks;
368 1.1 itojun volatile u_int16_t header_skip;
369 1.1 itojun volatile u_int32_t source_count;
370 1.1 itojun } hifn_crypt_command_t;
371 1.1 itojun
372 1.1 itojun #define HIFN_CRYPT_CMD_ALG_MASK (0x3 << 0)
373 1.1 itojun #define HIFN_CRYPT_CMD_ALG_DES (0x0 << 0)
374 1.1 itojun #define HIFN_CRYPT_CMD_ALG_3DES (0x1 << 0)
375 1.1 itojun #define HIFN_CRYPT_CMD_MODE_CBC (0x1 << 3)
376 1.1 itojun #define HIFN_CRYPT_CMD_NEW_KEY (0x1 << 11)
377 1.1 itojun #define HIFN_CRYPT_CMD_NEW_IV (0x1 << 12)
378 1.1 itojun
379 1.1 itojun /*
380 1.1 itojun * Structure to help build up the command data structure.
381 1.1 itojun */
382 1.1 itojun typedef struct hifn_mac_command {
383 1.1 itojun volatile u_int16_t masks;
384 1.1 itojun volatile u_int16_t header_skip;
385 1.1 itojun volatile u_int32_t source_count;
386 1.1 itojun } hifn_mac_command_t;
387 1.1 itojun
388 1.1 itojun #define HIFN_MAC_CMD_ALG_MD5 (0x1 << 0)
389 1.1 itojun #define HIFN_MAC_CMD_ALG_SHA1 (0x0 << 0)
390 1.1 itojun #define HIFN_MAC_CMD_MODE_HMAC (0x0 << 2)
391 1.1 itojun #define HIFN_MAC_CMD_TRUNC (0x1 << 4)
392 1.1 itojun #define HIFN_MAC_CMD_RESULT (0x1 << 5)
393 1.1 itojun #define HIFN_MAC_CMD_APPEND (0x1 << 6)
394 1.1 itojun /*
395 1.1 itojun * MAC POS IPSec initiates authentication after encryption on encodes
396 1.1 itojun * and before decryption on decodes.
397 1.1 itojun */
398 1.1 itojun #define HIFN_MAC_CMD_POS_IPSEC (0x2 << 8)
399 1.1 itojun #define HIFN_MAC_CMD_NEW_KEY (0x1 << 11)
400 1.1 itojun
401 1.1 itojun /*
402 1.1 itojun * The poll frequency and poll scalar defines are unshifted values used
403 1.1 itojun * to set fields in the DMA Configuration Register.
404 1.1 itojun */
405 1.1 itojun #ifndef HIFN_POLL_FREQUENCY
406 1.1 itojun #define HIFN_POLL_FREQUENCY 0x1
407 1.1 itojun #endif
408 1.1 itojun
409 1.1 itojun #ifndef HIFN_POLL_SCALAR
410 1.1 itojun #define HIFN_POLL_SCALAR 0x0
411 1.1 itojun #endif
412 1.1 itojun
413 1.1 itojun #endif /* __DEV_PCI_HIFN7751REG_H__ */
414