1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 #define BS_BAR 0x10
41 #define BS_TRDY_TIMEOUT 0x40
42 #define BS_RETRY_TIMEOUT 0x41
43
44 #define UBS_PCI_RTY_SHIFT 8
45 #define UBS_PCI_RTY_MASK 0xff
46 #define UBS_PCI_RTY(misc) \
47 (((misc) >> UBS_PCI_RTY_SHIFT) & UBS_PCI_RTY_MASK)
48
49 #define UBS_PCI_TOUT_SHIFT 0
50 #define UBS_PCI_TOUT_MASK 0xff
51 #define UBS_PCI_TOUT(misc) \
52 (((misc) >> PCI_TOUT_SHIFT) & PCI_TOUT_MASK)
53
54
55
56
57 #define BS_MCR1 0x00
58 #define BS_CTRL 0x04
59 #define BS_STAT 0x08
60 #define BS_ERR 0x0c
61 #define BS_MCR2 0x10
62
63
64 #define BS_CTRL_RESET 0x80000000
65 #define BS_CTRL_MCR2INT 0x40000000
66 #define BS_CTRL_MCR1INT 0x20000000
67 #define BS_CTRL_OFM 0x10000000
68 #define BS_CTRL_BE32 0x08000000
69 #define BS_CTRL_BE64 0x04000000
70 #define BS_CTRL_DMAERR 0x02000000
71 #define BS_CTRL_RNG_M 0x01800000
72 #define BS_CTRL_RNG_1 0x00000000
73 #define BS_CTRL_RNG_4 0x00800000
74 #define BS_CTRL_RNG_8 0x01000000
75 #define BS_CTRL_RNG_16 0x01800000
76 #define BS_CTRL_SWNORM 0x00400000
77 #define BS_CTRL_FRAG_M 0x0000ffff
78 #define BS_CTRL_LITTLE_ENDIAN (BS_CTRL_BE32 | BS_CTRL_BE64)
79
80
81 #define BS_STAT_MCR1_BUSY 0x80000000
82 #define BS_STAT_MCR1_FULL 0x40000000
83 #define BS_STAT_MCR1_DONE 0x20000000
84 #define BS_STAT_DMAERR 0x10000000
85 #define BS_STAT_MCR2_FULL 0x08000000
86 #define BS_STAT_MCR2_DONE 0x04000000
87 #define BS_STAT_MCR1_ALLEMPTY 0x02000000
88 #define BS_STAT_MCR2_ALLEMPTY 0x01000000
89
90
91 #define BS_ERR_ADDR 0xfffffffc
92 #define BS_ERR_READ 0x00000002
93
94 struct ubsec_pktctx {
95 u_int32_t pc_deskey[6];
96 u_int32_t pc_hminner[5];
97 u_int32_t pc_hmouter[5];
98 u_int32_t pc_iv[2];
99 u_int16_t pc_flags;
100 u_int16_t pc_offset;
101 };
102 #define UBS_PKTCTX_ENC_3DES 0x8000
103 #define UBS_PKTCTX_ENC_NONE 0x0000
104 #define UBS_PKTCTX_INBOUND 0x4000
105 #define UBS_PKTCTX_AUTH 0x3000
106 #define UBS_PKTCTX_AUTH_NONE 0x0000
107 #define UBS_PKTCTX_AUTH_MD5 0x1000
108 #define UBS_PKTCTX_AUTH_SHA1 0x2000
109
110 struct ubsec_pktctx_long {
111 volatile u_int16_t pc_len;
112 volatile u_int16_t pc_type;
113 volatile u_int16_t pc_flags;
114 volatile u_int16_t pc_offset;
115 volatile u_int32_t pc_deskey[6];
116 volatile u_int32_t pc_iv[2];
117 volatile u_int32_t pc_hminner[5];
118 volatile u_int32_t pc_hmouter[5];
119 };
120 #define UBS_PKTCTX_TYPE_IPSEC 0x0000
121
122 struct ubsec_pktbuf {
123 volatile u_int32_t pb_addr;
124 volatile u_int32_t pb_next;
125 volatile u_int32_t pb_len;
126 };
127 #define UBS_PKTBUF_LEN 0x0000ffff
128
129 struct ubsec_mcr {
130 volatile u_int16_t mcr_pkts;
131 volatile u_int16_t mcr_flags;
132 volatile u_int32_t mcr_cmdctxp;
133 struct ubsec_pktbuf mcr_ipktbuf;
134 volatile u_int16_t mcr_reserved;
135 volatile u_int16_t mcr_pktlen;
136 struct ubsec_pktbuf mcr_opktbuf;
137 };
138
139 struct ubsec_mcr_add {
140 volatile u_int32_t mcr_cmdctxp;
141 struct ubsec_pktbuf mcr_ipktbuf;
142 volatile u_int16_t mcr_reserved;
143 volatile u_int16_t mcr_pktlen;
144 struct ubsec_pktbuf mcr_opktbuf;
145 };
146
147 #define UBS_MCR_DONE 0x0001
148 #define UBS_MCR_ERROR 0x0002
149 #define UBS_MCR_ERRORCODE 0xff00
150
151 struct ubsec_ctx_keyop {
152 volatile u_int16_t ctx_len;
153 volatile u_int16_t ctx_op;
154 volatile u_int8_t ctx_pad[60];
155 };
156 #define UBS_CTXOP_DHPKGEN 0x01
157 #define UBS_CTXOP_DHSSGEN 0x02
158 #define UBS_CTXOP_RSAPUB 0x03
159 #define UBS_CTXOP_RSAPRIV 0x04
160 #define UBS_CTXOP_DSASIGN 0x05
161 #define UBS_CTXOP_DSAVRFY 0x06
162 #define UBS_CTXOP_RNGBYPASS 0x41
163 #define UBS_CTXOP_RNGSHA1 0x42
164 #define UBS_CTXOP_MODADD 0x43
165 #define UBS_CTXOP_MODSUB 0x44
166 #define UBS_CTXOP_MODMUL 0x45
167 #define UBS_CTXOP_MODRED 0x46
168 #define UBS_CTXOP_MODEXP 0x47
169 #define UBS_CTXOP_MODINV 0x48
170
171 struct ubsec_ctx_rngbypass {
172 volatile u_int16_t rbp_len;
173 volatile u_int16_t rbp_op;
174 volatile u_int8_t rbp_pad[60];
175 };
176
177
178 struct ubsec_ctx_modexp {
179 volatile u_int16_t me_len;
180 volatile u_int16_t me_op;
181 volatile u_int16_t me_E_len;
182 volatile u_int16_t me_N_len;
183 u_int8_t me_N[2048/8];
184 };
185
186 struct ubsec_ctx_rsapriv {
187 volatile u_int16_t rpr_len;
188 volatile u_int16_t rpr_op;
189 volatile u_int16_t rpr_q_len;
190 volatile u_int16_t rpr_p_len;
191 u_int8_t rpr_buf[5 * 1024 / 8];
192
193 };