OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [net/] [ibmtr.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/* Definitions for an IBM Token Ring card. */
2
/* This file is distributed under the GNU GPL   */
3
 
4
/* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */
5
 
6
#define TR_RETRY_INTERVAL (5*HZ) /* 500 on PC = 5 s */
7
#define TR_RESET_INTERVAL (HZ/20) /* 5 on PC = 50 ms */
8
#define TR_BUSY_INTERVAL (HZ/5) /* 5 on PC = 200 ms */
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
/* Note, 0xA20 == 0x220 since motherboard decodes 10 bits.  I left everything
35
   the way my documentation had it, ie: 0x0A20.     */
36
#define ADAPTINTCNTRL   0x02f0  /* Adapter interrupt control */
37
#define ADAPTRESET      0x1     /* Control Adapter reset (add to base) */
38
#define ADAPTRESETREL   0x2     /* Release Adapter from reset ( """)  */
39
#define ADAPTINTREL     0x3     /* Adapter interrupt release */
40
 
41
#define MMIOStartLocP   0x0a20  /* Primary adapter's starting MMIO area */
42
#define MMIOStartLocA   0x0a24  /* Alternate adapter's starting MMIO area */
43
 
44
#define TR_IO_EXTENT    4       /* size of used IO range */
45
 
46
#define GLOBAL_INT_ENABLE 0x02f0
47
 
48
/* MMIO bits 0-4 select register */
49
#define RRR_EVEN        0x00    /* Shared RAM relocation registers - even and odd */
50
/* Used to set the starting address of shared RAM  */
51
/* Bits 1 through 7 of this register map to bits 13 through 19 of the shared RAM address.*/
52
/* ie: 0x02 sets RAM address to ...ato!  issy su wazzoo !! GODZILLA!!! */
53
#define RRR_ODD         0x01
54
/* Bits 2 and 3 of this register can be read to determine shared RAM size */
55
/* 00 for 8k, 01 for 16k, 10 for 32k, 11 for 64k  */
56
#define WRBR_EVEN       0x02    /* Write region base registers - even and odd */
57
#define WRBR_ODD        0x03
58
#define WWOR_EVEN       0x04    /* Write window open registers - even and odd */
59
#define WWOR_ODD        0x05
60
#define WWCR_EVEN       0x06    /* Write window close registers - even and odd */
61
#define WWCR_ODD        0x07
62
 
63
/* Interrupt status registers - PC system  - even and odd */
64
#define ISRP_EVEN       0x08
65
 
66
#define TCR_INT 0x10    /* Bit 4 - Timer interrupt.  The TVR_EVEN timer has
67
                                                                   expired. */
68
#define ERR_INT 0x08    /* Bit 3 - Error interrupt.  The adapter has had an
69
                                                                   internal error. */
70
#define ACCESS_INT 0x04    /* Bit 2 - Access interrupt.  You have attempted to
71
                                                           write to an invalid area of shared RAM or an invalid
72
                                                                   register within the MMIO. */
73
/*      In addition, the following bits within ISRP_EVEN can be turned on or off by you */
74
/*      to control the interrupt processing:   */
75
#define INT_IRQ 0x80    /* Bit 7 - If 0 the adapter will issue a CHCK, if 1 and
76
                                                              IRQ.  This should normally be set (by you) to 1.  */
77
#define INT_ENABLE 0x40 /* Bit 6 - Interrupt enable.  If 0, no interrupts will
78
                                                                   occur.  If 1, interrupts will occur normally.
79
                                                                   Normally set to 1.  */
80
/* Bit 0 - Primary or alternate adapter.  Set to zero if this adapter is the primary adapter,*/
81
/*         1 if this adapter is the alternate adapter. */
82
 
83
 
84
#define ISRP_ODD        0x09
85
 
86
#define ADAP_CHK_INT 0x40 /* Bit 6 - Adapter check.  the adapter has
87
                             encountered a serious problem and has closed
88
                             itself.  Whoa.  */
89
#define SRB_RESP_INT 0x20 /* Bit 5 - SRB response.  The adapter has accepted
90
                             an SRB request and set the return code within
91
                             the SRB. */
92
#define ASB_FREE_INT 0x10 /* Bit 4 - ASB free.  The adapter has read the ASB
93
                                                                          and this area can be safely reused. This interrupt
94
                                                                          is only used if your application has set the ASB
95
                                                                          free request bit in ISRA_ODD or if an error was
96
                                                                detected in your response. */
97
#define ARB_CMD_INT  0x08 /* Bit 3 - ARB command.  The adapter has given you a
98
                                                                          command for action.  The command is located in the
99
                                                                          ARB area of shared memory. */
100
#define SSB_RESP_INT 0x04 /* Bit 2 - SSB response.  The adapter has posted a
101
                                                                          response to your SRB (the response is located in
102
                                                                          the SSB area of shared memory). */
103
/* Bit 1 - Bridge frame forward complete. */
104
 
105
 
106
 
107
#define ISRA_EVEN       0x0A    /* Interrupt status registers - adapter  - even and odd */
108
/* Bit 7 - Internal parity error (on adapter's internal bus) */
109
/* Bit 6 - Timer interrupt pending */
110
/* Bit 5 - Access interrupt (attempt by adapter to access illegal address) */
111
/* Bit 4 - Adapter microcode problem (microcode dead-man timer expired) */
112
/* Bit 3 - Adapter processor check status */
113
/* Bit 2 - Reserved */
114
/* Bit 1 - Adapter hardware interrupt mask (prevents internal interrupts) */
115
/* Bit 0 - Adapter software interrupt mask (prevents internal software interrupts) */
116
 
117
#define ISRA_ODD        0x0B
118
#define CMD_IN_SRB 0x20 /* Bit 5  - Indicates that you have placed a new
119
                           command in the SRB and are ready for the adapter to
120
                           process the command. */
121
#define RESP_IN_ASB 0x10 /* Bit 4 - Indicates that you have placed a response
122
                                                                    (an ASB) in the shared RAM which is available for
123
                                                                         the adapter's use. */
124
/* Bit 3 - Indicates that you are ready to put an SRB in the shared RAM, but that a previous */
125
/*         command is still pending.  The adapter will then interrupt you when the previous */
126
/*         command is completed */
127
/* Bit 2 - Indicates that you are ready to put an ASB in the shared RAM, but that a previous */
128
/*         ASB is still pending.  The adapter will then interrupt you when the previous ASB */
129
/*         is copied.  */
130
#define ARB_FREE 0x2
131
#define SSB_FREE 0x1
132
 
133
#define TCR_EVEN        0x0C    /* Timer control registers - even and odd */
134
#define TCR_ODD         0x0D
135
#define TVR_EVEN        0x0E    /* Timer value registers - even and odd */
136
#define TVR_ODD         0x0F
137
#define SRPR_EVEN       0x10    /* Shared RAM paging registers - even and odd */
138
#define SRPR_ENABLE_PAGING 0xc0
139
#define SRPR_ODD        0x11 /* Not used. */
140
#define TOKREAD         0x60
141
#define TOKOR           0x40
142
#define TOKAND          0x20
143
#define TOKWRITE        0x00
144
 
145
/* MMIO bits 5-6 select operation */
146
/* 00 is used to write to a register */
147
/* 01 is used to bitwise AND a byte with a register */
148
/* 10 is used to bitwise OR a byte with a register  */
149
/* 11 is used to read from a register */
150
 
151
/* MMIO bits 7-8 select area of interest.. see below */
152
/* 00 selects attachment control area. */
153
/* 01 is reserved. */
154
/* 10 selects adapter identification area A containing the adapter encoded address. */
155
/* 11 selects the adapter identification area B containing test patterns. */
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
/* do_tok_int possible values */
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
        /* Additions by David Morris       */
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
        /* Additions by Peter De Schrijver */
195
        unsigned char page_mask;          /* mask to select RAM page to Map*/
196
        unsigned char mapped_ram_size;    /* size of RAM page */
197
        __u32 sram;                       /* Shared memory base address */
198
        __u32 init_srb;                   /* Initial System Request Block address */
199
        __u32 srb;                        /* System Request Block address */
200
        __u32 ssb;                        /* System Status Block address */
201
        __u32 arb;                        /* Adapter Request Block address */
202
        __u32 asb;                        /* Adapter Status Block address */
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
        unsigned char readlog_pending;
210
};
211
 
212
/* token ring adapter commands */
213
#define DIR_INTERRUPT           0x00 /* struct srb_interrupt */
214
#define DIR_MOD_OPEN_PARAMS     0x01
215
#define DIR_OPEN_ADAPTER        0x03 /* struct dir_open_adapter */
216
#define DIR_CLOSE_ADAPTER       0x04
217
#define DIR_SET_GRP_ADDR        0x06
218
#define DIR_SET_FUNC_ADDR       0x07
219
#define DIR_READ_LOG            0x08 /* struct srb_read_log */
220
#define DLC_OPEN_SAP            0x15 /* struct dlc_open_sap */
221
#define DLC_CLOSE_SAP           0x16
222
#define DATA_LOST               0x20 /* struct asb_rec */
223
#define REC_DATA                0x81 /* struct arb_rec_req */
224
#define XMIT_DATA_REQ           0x82 /* struct arb_xmit_req */
225
#define DLC_STATUS              0x83 /* struct arb_dlc_status */
226
#define RING_STAT_CHANGE        0x84 /* struct dlc_open_sap ??? */
227
 
228
/* DIR_OPEN_ADAPTER options */
229
#define OPEN_PASS_BCON_MAC 0x0100
230
#define NUM_RCV_BUF 16
231
#define RCV_BUF_LEN 136
232
#define DHB_LENGTH 2048
233
#define NUM_DHB 2
234
#define DLC_MAX_SAP 2
235
#define DLC_MAX_STA 1
236
 
237
/* DLC_OPEN_SAP options */
238
#define MAX_I_FIELD 0x0088
239
#define SAP_OPEN_IND_SAP 0x04
240
#define SAP_OPEN_PRIORITY 0x20
241
#define SAP_OPEN_STATION_CNT 0x1
242
#define XMIT_DIR_FRAME 0x0A
243
#define XMIT_UI_FRAME  0x0d
244
#define XMIT_XID_CMD   0x0e
245
#define XMIT_TEST_CMD  0x11
246
 
247
/* srb close return code */
248
#define SIGNAL_LOSS  0x8000
249
#define HARD_ERROR   0x4000
250
#define XMIT_BEACON  0x1000
251
#define LOBE_FAULT   0x0800
252
#define AUTO_REMOVAL 0x0400
253
#define REMOVE_RECV  0x0100
254
#define LOG_OVERFLOW 0x0080
255
#define RING_RECOVER 0x0020
256
 
257
struct srb_init_response {
258
        unsigned char command;
259
        unsigned char init_status;
260
        unsigned char init_status_2;
261
        unsigned char reserved[3];
262
        __u16 bring_up_code;
263
        __u16 encoded_address;
264
        __u16 level_address;
265
        __u16 adapter_address;
266
        __u16 parms_address;
267
        __u16 mac_address;
268
};
269
 
270
struct dir_open_adapter {
271
        unsigned char command;
272
        char reserved[7];
273
        __u16 open_options;
274
        unsigned char node_address[6];
275
        unsigned char group_address[4];
276
        unsigned char funct_address[4];
277
        __u16 num_rcv_buf;
278
        __u16 rcv_buf_len;
279
        __u16 dhb_length;
280
        unsigned char num_dhb;
281
        char reserved2;
282
        unsigned char dlc_max_sap;
283
        unsigned char dlc_max_sta;
284
        unsigned char dlc_max_gsap;
285
        unsigned char dlc_max_gmem;
286
        unsigned char dlc_t1_tick_1;
287
        unsigned char dlc_t2_tick_1;
288
        unsigned char dlc_ti_tick_1;
289
        unsigned char dlc_t1_tick_2;
290
        unsigned char dlc_t2_tick_2;
291
        unsigned char dlc_ti_tick_2;
292
        unsigned char product_id[18];
293
};
294
 
295
struct srb_open_response {
296
        unsigned char command;
297
        unsigned char reserved1;
298
        unsigned char ret_code;
299
        unsigned char reserved2[3];
300
        __u16 error_code;
301
        __u16 asb_addr;
302
        __u16 srb_addr;
303
        __u16 arb_addr;
304
        __u16 ssb_addr;
305
};
306
 
307
struct dlc_open_sap {
308
        unsigned char command;
309
        unsigned char reserved1;
310
        unsigned char ret_code;
311
        unsigned char reserved2;
312
        __u16 station_id;
313
        unsigned char timer_t1;
314
        unsigned char timer_t2;
315
        unsigned char timer_ti;
316
        unsigned char maxout;
317
        unsigned char maxin;
318
        unsigned char maxout_incr;
319
        unsigned char max_retry_count;
320
        unsigned char gsap_max_mem;
321
        __u16 max_i_field;
322
        unsigned char sap_value;
323
        unsigned char sap_options;
324
        unsigned char station_count;
325
        unsigned char sap_gsap_mem;
326
        unsigned char gsap[0];
327
};
328
 
329
struct srb_xmit {
330
        unsigned char command;
331
        unsigned char cmd_corr;
332
        unsigned char ret_code;
333
        unsigned char reserved1;
334
        __u16 station_id;
335
};
336
 
337
struct srb_interrupt {
338
        unsigned char command;
339
        unsigned char cmd_corr;
340
        unsigned char ret_code;
341
};
342
 
343
struct srb_read_log {
344
        unsigned char command;
345
        unsigned char reserved1;
346
        unsigned char ret_code;
347
        unsigned char reserved2;
348
        unsigned char line_errors;
349
        unsigned char internal_errors;
350
        unsigned char burst_errors;
351
        unsigned char A_C_errors;
352
        unsigned char abort_delimiters;
353
        unsigned char reserved3;
354
        unsigned char lost_frames;
355
        unsigned char recv_congest_count;
356
        unsigned char frame_copied_errors;
357
        unsigned char frequency_errors;
358
        unsigned char token_errors;
359
};
360
 
361
struct asb_xmit_resp {
362
        unsigned char command;
363
        unsigned char cmd_corr;
364
        unsigned char ret_code;
365
        unsigned char reserved;
366
        __u16 station_id;
367
        __u16 frame_length;
368
        unsigned char hdr_length;
369
        unsigned char rsap_value;
370
};
371
 
372
struct arb_xmit_req {
373
        unsigned char command;
374
        unsigned char cmd_corr;
375
        unsigned char reserved1[2];
376
        __u16 station_id;
377
        __u16 dhb_address;
378
};
379
 
380
struct arb_rec_req {
381
        unsigned char command;
382
        unsigned char reserved1[3];
383
        __u16 station_id;
384
        __u16 rec_buf_addr;
385
        unsigned char lan_hdr_len;
386
        unsigned char dlc_hdr_len;
387
        __u16 frame_len;
388
        unsigned char msg_type;
389
};
390
 
391
struct asb_rec {
392
        unsigned char command;
393
        unsigned char reserved1;
394
        unsigned char ret_code;
395
        unsigned char reserved2;
396
        __u16 station_id;
397
        __u16 rec_buf_addr;
398
};
399
 
400
struct rec_buf {
401
        unsigned char reserved1[2];
402
        __u16 buf_ptr;
403
        unsigned char reserved2;
404
        __u16 buf_len;
405
        unsigned char data[0];
406
};
407
 
408
struct arb_dlc_status {
409
        unsigned char command;
410
        unsigned char reserved1[3];
411
        __u16 station_id;
412
        __u16 status;
413
        unsigned char frmr_data[5];
414
        unsigned char access_prio;
415
        unsigned char rem_addr[TR_ALEN];
416
        unsigned char rsap_value;
417
};
418
 
419
struct arb_ring_stat_change {
420
        unsigned char command;
421
        unsigned char reserved1[5];
422
        __u16 ring_status;
423
};
424
 
425
struct srb_close_adapter {
426
        unsigned char command;
427
        unsigned char reserved1;
428
        unsigned char ret_code;
429
};
430
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.