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