1
2
3
4
5
6 #define TR_RETRY_INTERVAL (5*HZ)
7 #define TR_RESET_INTERVAL (HZ/20)
8 #define TR_BUSY_INTERVAL (HZ/5)
9
10 #define TR_ISA 1
11 #define TR_MCA 2
12 #define TR_ISAPNP 3
13 #define NOTOK 0
14 #define TOKDEBUG 1
15
16 #ifndef IBMTR_SHARED_RAM_BASE
17 #define IBMTR_SHARED_RAM_BASE 0xD0
18 #define IBMTR_SHARED_RAM_SIZE 0x10
19 #endif
20
21 #define CHANNEL_ID 0X1F30
22 #define AIP 0X1F00
23 #define AIPCHKSUM1 0X1F60
24 #define AIPCHKSUM2 0X1FF0
25 #define AIPADAPTYPE 0X1FA0
26 #define AIPDATARATE 0X1FA2
27 #define AIPEARLYTOKEN 0X1FA4
28 #define AIPAVAILSHRAM 0X1FA6
29 #define AIPSHRAMPAGE 0X1FA8
30 #define AIP4MBDHB 0X1FAA
31 #define AIP16MBDHB 0X1FAC
32 #define AIPFID 0X1FBA
33
34
35
36 #define ADAPTINTCNTRL 0x02f0
37 #define ADAPTRESET 0x1
38 #define ADAPTRESETREL 0x2
39 #define ADAPTINTREL 0x3
40
41 #define MMIOStartLocP 0x0a20
42 #define MMIOStartLocA 0x0a24
43
44 #define TR_IO_EXTENT 4
45
46 #define GLOBAL_INT_ENABLE 0x02f0
47
48
49 #define RRR_EVEN 0x00
50
51
52
53 #define RRR_ODD 0x01
54
55
56 #define WRBR_EVEN 0x02
57 #define WRBR_ODD 0x03
58 #define WWOR_EVEN 0x04
59 #define WWOR_ODD 0x05
60 #define WWCR_EVEN 0x06
61 #define WWCR_ODD 0x07
62
63
64 #define ISRP_EVEN 0x08
65
66 #define TCR_INT 0x10
67
68 #define ERR_INT 0x08
69
70 #define ACCESS_INT 0x04
71
72
73
74
75 #define INT_IRQ 0x80
76
77 #define INT_ENABLE 0x40
78
79
80
81
82
83
84 #define ISRP_ODD 0x09
85
86 #define ADAP_CHK_INT 0x40
87
88
89 #define SRB_RESP_INT 0x20
90
91
92 #define ASB_FREE_INT 0x10
93
94
95
96
97 #define ARB_CMD_INT 0x08
98
99
100 #define SSB_RESP_INT 0x04
101
102
103
104
105
106
107 #define ISRA_EVEN 0x0A
108
109
110
111
112
113
114
115
116
117 #define ISRA_ODD 0x0B
118 #define CMD_IN_SRB 0x20
119
120
121 #define RESP_IN_ASB 0x10
122
123
124
125
126
127
128
129
130 #define ARB_FREE 0x2
131 #define SSB_FREE 0x1
132
133 #define TCR_EVEN 0x0C
134 #define TCR_ODD 0x0D
135 #define TVR_EVEN 0x0E
136 #define TVR_ODD 0x0F
137 #define SRPR_EVEN 0x10
138 #define SRPR_ENABLE_PAGING 0xc0
139 #define SRPR_ODD 0x11
140 #define TOKREAD 0x60
141 #define TOKOR 0x40
142 #define TOKAND 0x20
143 #define TOKWRITE 0x00
144
145
146
147
148
149
150
151
152
153
154
155
156
157 #define PCCHANNELID 5049434F3631313039393020
158 #define MCCHANNELID 4D4152533633583435313820
159
160 #define ACA_OFFSET 0x1e00
161 #define ACA_SET 0x40
162 #define ACA_RESET 0x20
163 #define ACA_RW 0x00
164
165 #ifdef ENABLE_PAGING
166 #define SET_PAGE(x) (writeb(((x>>8)&ti.page_mask), \
167 ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN))
168 #else
169 #define SET_PAGE(x)
170 #endif
171
172 typedef enum { IN_PROGRESS, SUCCESS, FAILURE, CLOSED } open_state;
173
174
175 #define FIRST_INT 1
176 #define NOT_FIRST 2
177
178 struct tok_info {
179 unsigned char irq;
180 __u32 mmio;
181 unsigned char hw_address[32];
182 unsigned char adapter_type;
183 unsigned char data_rate;
184 unsigned char token_release;
185 unsigned char avail_shared_ram;
186 unsigned char shared_ram_paging;
187 unsigned char dhb_size4mb;
188 unsigned char dhb_size16mb;
189
190 unsigned char do_tok_int;
191 struct wait_queue *wait_for_tok_int;
192 struct wait_queue *wait_for_reset;
193 unsigned char sram_base;
194
195 unsigned char page_mask;
196 unsigned char mapped_ram_size;
197 __u32 sram;
198 __u32 init_srb;
199 __u32 srb;
200 __u32 ssb;
201 __u32 arb;
202 __u32 asb;
203 unsigned short exsap_station_id;
204 unsigned short global_int_enable;
205 struct sk_buff *current_skb;
206 struct tr_statistics tr_stats;
207 unsigned char auto_ringspeedsave;
208 open_state open_status;
209 };
210
211
212 #define DIR_INTERRUPT 0x00
213 #define DIR_MOD_OPEN_PARAMS 0x01
214 #define DIR_OPEN_ADAPTER 0x03
215 #define DIR_CLOSE_ADAPTER 0x04
216 #define DIR_SET_GRP_ADDR 0x06
217 #define DIR_SET_FUNC_ADDR 0x07
218 #define DIR_READ_LOG 0x08
219 #define DLC_OPEN_SAP 0x15
220 #define DLC_CLOSE_SAP 0x16
221 #define DATA_LOST 0x20
222 #define REC_DATA 0x81
223 #define XMIT_DATA_REQ 0x82
224 #define DLC_STATUS 0x83
225 #define RING_STAT_CHANGE 0x84
226
227
228 #define OPEN_PASS_BCON_MAC 0x0100
229 #define NUM_RCV_BUF 16
230 #define RCV_BUF_LEN 136
231 #define DHB_LENGTH 2048
232 #define NUM_DHB 2
233 #define DLC_MAX_SAP 2
234 #define DLC_MAX_STA 1
235
236
237 #define MAX_I_FIELD 0x0088
238 #define SAP_OPEN_IND_SAP 0x04
239 #define SAP_OPEN_PRIORITY 0x20
240 #define SAP_OPEN_STATION_CNT 0x1
241 #define XMIT_DIR_FRAME 0x0A
242 #define XMIT_UI_FRAME 0x0d
243 #define XMIT_XID_CMD 0x0e
244 #define XMIT_TEST_CMD 0x11
245
246
247 #define SIGNAL_LOSS 0x8000
248 #define HARD_ERROR 0x4000
249 #define XMIT_BEACON 0x1000
250 #define LOBE_FAULT 0x0800
251 #define AUTO_REMOVAL 0x0400
252 #define REMOVE_RECV 0x0100
253 #define LOG_OVERFLOW 0x0080
254 #define RING_RECOVER 0x0020
255
256 struct srb_init_response {
257 unsigned char command;
258 unsigned char init_status;
259 unsigned char init_status_2;
260 unsigned char reserved[3];
261 __u16 bring_up_code;
262 __u16 encoded_address;
263 __u16 level_address;
264 __u16 adapter_address;
265 __u16 parms_address;
266 __u16 mac_address;
267 };
268
269 struct dir_open_adapter {
270 unsigned char command;
271 char reserved[7];
272 __u16 open_options;
273 unsigned char node_address[6];
274 unsigned char group_address[4];
275 unsigned char funct_address[4];
276 __u16 num_rcv_buf;
277 __u16 rcv_buf_len;
278 __u16 dhb_length;
279 unsigned char num_dhb;
280 char reserved2;
281 unsigned char dlc_max_sap;
282 unsigned char dlc_max_sta;
283 unsigned char dlc_max_gsap;
284 unsigned char dlc_max_gmem;
285 unsigned char dlc_t1_tick_1;
286 unsigned char dlc_t2_tick_1;
287 unsigned char dlc_ti_tick_1;
288 unsigned char dlc_t1_tick_2;
289 unsigned char dlc_t2_tick_2;
290 unsigned char dlc_ti_tick_2;
291 unsigned char product_id[18];
292 };
293
294 struct srb_open_response {
295 unsigned char command;
296 unsigned char reserved1;
297 unsigned char ret_code;
298 unsigned char reserved2[3];
299 __u16 error_code;
300 __u16 asb_addr;
301 __u16 srb_addr;
302 __u16 arb_addr;
303 __u16 ssb_addr;
304 };
305
306 struct dlc_open_sap {
307 unsigned char command;
308 unsigned char reserved1;
309 unsigned char ret_code;
310 unsigned char reserved2;
311 __u16 station_id;
312 unsigned char timer_t1;
313 unsigned char timer_t2;
314 unsigned char timer_ti;
315 unsigned char maxout;
316 unsigned char maxin;
317 unsigned char maxout_incr;
318 unsigned char max_retry_count;
319 unsigned char gsap_max_mem;
320 __u16 max_i_field;
321 unsigned char sap_value;
322 unsigned char sap_options;
323 unsigned char station_count;
324 unsigned char sap_gsap_mem;
325 unsigned char gsap[0];
326 };
327
328 struct srb_xmit {
329 unsigned char command;
330 unsigned char cmd_corr;
331 unsigned char ret_code;
332 unsigned char reserved1;
333 __u16 station_id;
334 };
335
336 struct srb_interrupt {
337 unsigned char command;
338 unsigned char cmd_corr;
339 unsigned char ret_code;
340 };
341
342 struct srb_read_log {
343 unsigned char command;
344 unsigned char reserved1;
345 unsigned char ret_code;
346 unsigned char reserved2;
347 unsigned char line_errors;
348 unsigned char internal_errors;
349 unsigned char burst_errors;
350 unsigned char A_C_errors;
351 unsigned char abort_delimiters;
352 unsigned char reserved3;
353 unsigned char lost_frames;
354 unsigned char recv_congest_count;
355 unsigned char frame_copied_errors;
356 unsigned char frequency_errors;
357 unsigned char token_errors;
358 };
359
360 struct asb_xmit_resp {
361 unsigned char command;
362 unsigned char cmd_corr;
363 unsigned char ret_code;
364 unsigned char reserved;
365 __u16 station_id;
366 __u16 frame_length;
367 unsigned char hdr_length;
368 unsigned char rsap_value;
369 };
370
371 struct arb_xmit_req {
372 unsigned char command;
373 unsigned char cmd_corr;
374 unsigned char reserved1[2];
375 __u16 station_id;
376 __u16 dhb_address;
377 };
378
379 struct arb_rec_req {
380 unsigned char command;
381 unsigned char reserved1[3];
382 __u16 station_id;
383 __u16 rec_buf_addr;
384 unsigned char lan_hdr_len;
385 unsigned char dlc_hdr_len;
386 __u16 frame_len;
387 unsigned char msg_type;
388 };
389
390 struct asb_rec {
391 unsigned char command;
392 unsigned char reserved1;
393 unsigned char ret_code;
394 unsigned char reserved2;
395 __u16 station_id;
396 __u16 rec_buf_addr;
397 };
398
399 struct rec_buf {
400 unsigned char reserved1[2];
401 __u16 buf_ptr;
402 unsigned char reserved2;
403 __u16 buf_len;
404 unsigned char data[0];
405 };
406
407 struct arb_dlc_status {
408 unsigned char command;
409 unsigned char reserved1[3];
410 __u16 station_id;
411 __u16 status;
412 unsigned char frmr_data[5];
413 unsigned char access_prio;
414 unsigned char rem_addr[TR_ALEN];
415 unsigned char rsap_value;
416 };
417
418 struct arb_ring_stat_change {
419 unsigned char command;
420 unsigned char reserved1[5];
421 __u16 ring_status;
422 };
423
424 struct srb_close_adapter {
425 unsigned char command;
426 unsigned char reserved1;
427 unsigned char ret_code;
428 };
429