* better
[mascara-docs.git] / i386 / linux-2.3.21 / drivers / net / tokenring / sktr.h
blob90b5c382f7b5ced75240cf72c1b789709d4a501c
1 /* sktr.h: SysKonnect TokenRing driver for Linux
3 * Authors:
4 * - Christoph Goos <cgoos@syskonnect.de>
5 */
7 #ifndef __LINUX_SKTR_H
8 #define __LINUX_SKTR_H
10 #ifdef __KERNEL__
12 #define SKTR_MAX_ADAPTERS 7
14 #define SEND_TIMEOUT 10*HZ
16 #define TR_RCF_LONGEST_FRAME_MASK 0x0070
17 #define TR_RCF_FRAME4K 0x0030
19 #define SK_ISA 0
20 #define SK_PCI 1
22 /*------------------------------------------------------------------*/
23 /* Bit order for adapter communication with DMA */
24 /* -------------------------------------------------------------- */
25 /* Bit 8 | 9| 10| 11|| 12| 13| 14| 15|| 0| 1| 2| 3|| 4| 5| 6| 7| */
26 /* -------------------------------------------------------------- */
27 /* The bytes in a word must be byte swapped. Also, if a double */
28 /* word is used for storage, then the words, as well as the bytes, */
29 /* must be swapped. */
30 /* Bit order for adapter communication with DIO */
31 /* -------------------------------------------------------------- */
32 /* Bit 0 | 1| 2| 3|| 4| 5| 6| 7|| 8| 9| 10| 11|| 12| 13| 14| 15| */
33 /* -------------------------------------------------------------- */
34 /*------------------------------------------------------------------*/
36 /* Swap bytes of a word. */
37 #define SWAPB(x) (((unsigned short)((x) << 8)) | ((unsigned short)((x) >> 8)))
39 /* Swap words of a long. */
40 #define SWAPW(x) (((x) << 16) | ((x) >> 16))
42 /* Get the low byte of a word. */
43 #define LOBYTE(w) ((unsigned char)(w))
45 /* Get the high byte of a word. */
46 #define HIBYTE(w) ((unsigned char)((unsigned short)(w) >> 8))
48 /* Get the low word of a long. */
49 #define LOWORD(l) ((unsigned short)(l))
51 /* Get the high word of a long. */
52 #define HIWORD(l) ((unsigned short)((unsigned long)(l) >> 16))
56 /* Token ring adapter I/O addresses for normal mode. */
57 #define SIFDAT 0L /* SIF/DMA data. */
58 #define SIFINC 2L /* IO Word data with auto increment. */
59 #define SIFINH 3L /* IO Byte data with auto increment. */
60 #define SIFADR 4L /* SIF/DMA Address. */
61 #define SIFCMD 6L /* SIF Command. */
62 #define SIFSTS 6L /* SIF Status. */
63 #define SIFACL 8L /* SIF Adapter Control Register. */
64 #define SIFADD 10L /* SIF/DMA Address. */
65 #define SIFADX 12L
66 #define DMALEN 14L /* SIF DMA length. */
67 #define POSREG 16L /* Adapter Program Option Select (POS)
68 * Register: base IO address + 16 byte.
70 #define POSREG_2 24L /* only for TR4/16+ adapter
71 * base IO address + 24 byte.
75 /* SIFCMD command codes (high-low) */
76 #define CMD_INTERRUPT_ADAPTER 0x8000 /* Cause internal adapter interrupt */
77 #define CMD_ADAPTER_RESET 0x4000 /* Hardware reset of adapter */
78 #define CMD_SSB_CLEAR 0x2000 /* Acknowledge to adapter to
79 * system interrupts.
81 #define CMD_EXECUTE 0x1000 /* Execute SCB command */
82 #define CMD_SCB_REQUEST 0x0800 /* Request adapter to interrupt
83 * system when SCB is available for
84 * another command.
86 #define CMD_RX_CONTINUE 0x0400 /* Continue receive after odd pointer
87 * stop. (odd pointer receive method)
89 #define CMD_RX_VALID 0x0200 /* Now actual RPL is valid. */
90 #define CMD_TX_VALID 0x0100 /* Now actual TPL is valid. (valid
91 * bit receive/transmit method)
93 #define CMD_SYSTEM_IRQ 0x0080 /* Adapter-to-attached-system
94 * interrupt is reset.
96 #define CMD_CLEAR_SYSTEM_IRQ 0x0080 /* Clear SYSTEM_INTERRUPT bit.
97 * (write: 1=ignore, 0=reset)
99 #define EXEC_SOFT_RESET 0xFF00 /* adapter soft reset. (restart
100 * adapter after hardware reset)
104 /* ACL commands (high-low) */
105 #define ACL_SWHLDA 0x0800 /* Software hold acknowledge. */
106 #define ACL_SWDDIR 0x0400 /* Data transfer direction. */
107 #define ACL_SWHRQ 0x0200 /* Pseudo DMA operation. */
108 #define ACL_PSDMAEN 0x0100 /* Enable pseudo system DMA. */
109 #define ACL_ARESET 0x0080 /* Adapter hardware reset command.
110 * (held in reset condition as
111 * long as bit is set)
113 #define ACL_CPHALT 0x0040 /* Communication processor halt.
114 * (can only be set while ACL_ARESET
115 * bit is set; prevents adapter
116 * processor from executing code while
117 * downloading firmware)
119 #define ACL_BOOT 0x0020
120 #define ACL_SINTEN 0x0008 /* System interrupt enable/disable
121 * (1/0): can be written if ACL_ARESET
122 * is zero.
124 #define ACL_SPEED4 0x0003
125 #define ACL_SPEED16 0x0001
126 #define PS_DMA_MASK (ACL_SWHRQ | ACL_PSDMAEN)
129 /* SIFSTS register return codes (high-low) */
130 #define STS_SYSTEM_IRQ 0x0080 /* Adapter-to-attached-system
131 * interrupt is valid.
133 #define STS_INITIALIZE 0x0040 /* INITIALIZE status. (ready to
134 * initialize)
136 #define STS_TEST 0x0020 /* TEST status. (BUD not completed) */
137 #define STS_ERROR 0x0010 /* ERROR status. (unrecoverable
138 * HW error occurred)
140 #define STS_MASK 0x00F0 /* Mask interesting status bits. */
141 #define STS_ERROR_MASK 0x000F /* Get Error Code by masking the
142 * interrupt code bits.
144 #define ADAPTER_INT_PTRS 0x0A00 /* Address offset of adapter internal
145 * pointers 01:0a00 (high-low) have to
146 * be read after init and before open.
150 /* Interrupt Codes (only MAC IRQs) */
151 #define STS_IRQ_ADAPTER_CHECK 0x0000 /* unrecoverable hardware or
152 * software error.
154 #define STS_IRQ_RING_STATUS 0x0004 /* SSB is updated with ring status. */
155 #define STS_IRQ_SCB_CLEAR 0x0006 /* SCB clear, following an
156 * SCB_REQUEST IRQ.
158 #define STS_IRQ_COMMAND_STATUS 0x0008 /* SSB is updated with command
159 * status.
161 #define STS_IRQ_RECEIVE_STATUS 0x000A /* SSB is updated with receive
162 * status.
164 #define STS_IRQ_TRANSMIT_STATUS 0x000C /* SSB is updated with transmit
165 * status
167 #define STS_IRQ_MASK 0x000F /* = STS_ERROR_MASK. */
170 /* TRANSMIT_STATUS completion code: (SSB.Parm[0]) */
171 #define COMMAND_COMPLETE 0x0080 /* TRANSMIT command completed
172 * (avoid this!) issue another transmit
173 * to send additional frames.
175 #define FRAME_COMPLETE 0x0040 /* Frame has been transmitted;
176 * INTERRUPT_FRAME bit was set in the
177 * CSTAT request; indication of possibly
178 * more than one frame transmissions!
179 * SSB.Parm[0-1]: 32 bit pointer to
180 * TPL of last frame.
182 #define LIST_ERROR 0x0020 /* Error in one of the TPLs that
183 * compose the frame; TRANSMIT
184 * terminated; Parm[1-2]: 32 bit pointer
185 * to TPL which starts the error
186 * frame; error details in bits 8-13.
187 * (14?)
189 #define FRAME_SIZE_ERROR 0x8000 /* FRAME_SIZE does not equal the sum of
190 * the valid DATA_COUNT fields;
191 * FRAME_SIZE less than header plus
192 * information field. (15 bytes +
193 * routing field) Or if FRAME_SIZE
194 * was specified as zero in one list.
196 #define TX_THRESHOLD 0x4000 /* FRAME_SIZE greater than (BUFFER_SIZE
197 * - 9) * TX_BUF_MAX.
199 #define ODD_ADDRESS 0x2000 /* Odd forward pointer value is
200 * read on a list without END_FRAME
201 * indication.
203 #define FRAME_ERROR 0x1000 /* START_FRAME bit is (not) anticipated,
204 * but (not) set.
206 #define ACCESS_PRIORITY_ERROR 0x0800 /* Access priority requested has not
207 * been allowed.
209 #define UNENABLED_MAC_FRAME 0x0400 /* MAC frame has source class of zero
210 * or MAC frame PCF ATTN field is
211 * greater than one.
213 #define ILLEGAL_FRAME_FORMAT 0x0200 /* Bit 0 or FC field was set to one. */
217 * Since we need to support some functions even if the adapter is in a
218 * CLOSED state, we have a (pseudo-) command queue which holds commands
219 * that are outstandig to be executed.
221 * Each time a command completes, an interrupt occurs and the next
222 * command is executed. The command queue is actually a simple word with
223 * a bit for each outstandig command. Therefore the commands will not be
224 * executed in the order they have been queued.
226 * The following defines the command code bits and the command queue:
228 #define OC_OPEN 0x0001 /* OPEN command */
229 #define OC_TRANSMIT 0x0002 /* TRANSMIT command */
230 #define OC_TRANSMIT_HALT 0x0004 /* TRANSMIT_HALT command */
231 #define OC_RECEIVE 0x0008 /* RECEIVE command */
232 #define OC_CLOSE 0x0010 /* CLOSE command */
233 #define OC_SET_GROUP_ADDR 0x0020 /* SET_GROUP_ADDR command */
234 #define OC_SET_FUNCT_ADDR 0x0040 /* SET_FUNCT_ADDR command */
235 #define OC_READ_ERROR_LOG 0x0080 /* READ_ERROR_LOG command */
236 #define OC_READ_ADAPTER 0x0100 /* READ_ADAPTER command */
237 #define OC_MODIFY_OPEN_PARMS 0x0400 /* MODIFY_OPEN_PARMS command */
238 #define OC_RESTORE_OPEN_PARMS 0x0800 /* RESTORE_OPEN_PARMS command */
239 #define OC_SET_FIRST_16_GROUP 0x1000 /* SET_FIRST_16_GROUP command */
240 #define OC_SET_BRIDGE_PARMS 0x2000 /* SET_BRIDGE_PARMS command */
241 #define OC_CONFIG_BRIDGE_PARMS 0x4000 /* CONFIG_BRIDGE_PARMS command */
243 #define OPEN 0x0300 /* C: open command. S: completion. */
244 #define TRANSMIT 0x0400 /* C: transmit command. S: completion
245 * status. (reject: COMMAND_REJECT if
246 * adapter not opened, TRANSMIT already
247 * issued or address passed in the SCB
248 * not word aligned)
250 #define TRANSMIT_HALT 0x0500 /* C: interrupt TX TPL chain; if no
251 * TRANSMIT command issued, the command
252 * is ignored. (completion with TRANSMIT
253 * status (0x0400)!)
255 #define RECEIVE 0x0600 /* C: receive command. S: completion
256 * status. (reject: COMMAND_REJECT if
257 * adapter not opened, RECEIVE already
258 * issued or address passed in the SCB
259 * not word aligned)
261 #define CLOSE 0x0700 /* C: close adapter. S: completion.
262 * (COMMAND_REJECT if adapter not open)
264 #define SET_GROUP_ADDR 0x0800 /* C: alter adapter group address after
265 * OPEN. S: completion. (COMMAND_REJECT
266 * if adapter not open)
268 #define SET_FUNCT_ADDR 0x0900 /* C: alter adapter functional address
269 * after OPEN. S: completion.
270 * (COMMAND_REJECT if adapter not open)
272 #define READ_ERROR_LOG 0x0A00 /* C: read adapter error counters.
273 * S: completion. (command ignored
274 * if adapter not open!)
276 #define READ_ADAPTER 0x0B00 /* C: read data from adapter memory.
277 * (important: after init and before
278 * open!) S: completion. (ADAPTER_CHECK
279 * interrupt if undefined storage area
280 * read)
282 #define MODIFY_OPEN_PARMS 0x0D00 /* C: modify some adapter operational
283 * parameters. (bit correspondend to
284 * WRAP_INTERFACE is ignored)
285 * S: completion. (reject:
286 * COMMAND_REJECT)
288 #define RESTORE_OPEN_PARMS 0x0E00 /* C: modify some adapter operational
289 * parameters. (bit correspondend
290 * to WRAP_INTERFACE is ignored)
291 * S: completion. (reject:
292 * COMMAND_REJECT)
294 #define SET_FIRST_16_GROUP 0x0F00 /* C: alter the first two bytes in
295 * adapter group address.
296 * S: completion. (reject:
297 * COMMAND_REJECT)
299 #define SET_BRIDGE_PARMS 0x1000 /* C: values and conditions for the
300 * adapter hardware to use when frames
301 * are copied for forwarding.
302 * S: completion. (reject:
303 * COMMAND_REJECT)
305 #define CONFIG_BRIDGE_PARMS 0x1100 /* C: ..
306 * S: completion. (reject:
307 * COMMAND_REJECT)
310 #define SPEED_4 4
311 #define SPEED_16 16 /* Default transmission speed */
314 /* Initialization Parameter Block (IPB); word alignment necessary! */
315 #define BURST_SIZE 0x0018 /* Default burst size */
316 #define BURST_MODE 0x9F00 /* Burst mode enable */
317 #define DMA_RETRIES 0x0505 /* Magic DMA retry number... */
319 #define CYCLE_TIME 3 /* Default AT-bus cycle time: 500 ns
320 * (later adapter version: fix cycle time!)
322 #define LINE_SPEED_BIT 0x80
324 /* Macro definition for the wait function. */
325 #define ONE_SECOND_TICKS 1000000
326 #define HALF_SECOND (ONE_SECOND_TICKS / 2)
327 #define ONE_SECOND (ONE_SECOND_TICKS)
328 #define TWO_SECONDS (ONE_SECOND_TICKS * 2)
329 #define THREE_SECONDS (ONE_SECOND_TICKS * 3)
330 #define FOUR_SECONDS (ONE_SECOND_TICKS * 4)
331 #define FIVE_SECONDS (ONE_SECOND_TICKS * 5)
333 #define BUFFER_SIZE 2048 /* Buffers on Adapter */
335 #pragma pack(1)
336 typedef struct {
337 unsigned short Init_Options; /* Initialize with burst mode;
338 * LLC disabled. (MAC only)
341 /* Interrupt vectors the adapter places on attached system bus. */
342 unsigned char CMD_Status_IV; /* Interrupt vector: command status. */
343 unsigned char TX_IV; /* Interrupt vector: transmit. */
344 unsigned char RX_IV; /* Interrupt vector: receive. */
345 unsigned char Ring_Status_IV; /* Interrupt vector: ring status. */
346 unsigned char SCB_Clear_IV; /* Interrupt vector: SCB clear. */
347 unsigned char Adapter_CHK_IV; /* Interrupt vector: adapter check. */
349 unsigned short RX_Burst_Size; /* Max. number of transfer cycles. */
350 unsigned short TX_Burst_Size; /* During DMA burst; even value! */
351 unsigned short DMA_Abort_Thrhld; /* Number of DMA retries. */
353 unsigned long SCB_Addr; /* SCB address: even, word aligned, high-low. */
354 unsigned long SSB_Addr; /* SSB address: even, word aligned, high-low. */
355 } IPB, *IPB_Ptr;
356 #pragma pack()
359 * OPEN Command Parameter List (OCPL) (can be reused, if the adapter has to
360 * be reopened)
362 #define BUFFER_SIZE 2048 /* Buffers on Adapter. */
363 #define TPL_SIZE 8+6*TX_FRAG_NUM /* Depending on fragments per TPL. */
364 #define RPL_SIZE 14 /* (with TI firmware v2.26 handling
365 * up to nine fragments possible)
367 #define TX_BUF_MIN 20 /* ??? (Stephan: calculation with */
368 #define TX_BUF_MAX 40 /* BUFFER_SIZE and MAX_FRAME_SIZE) ???
370 #define DISABLE_EARLY_TOKEN_RELEASE 0x1000
372 /* OPEN Options (high-low) */
373 #define WRAP_INTERFACE 0x0080 /* Inserting omitted for test
374 * purposes; transmit data appears
375 * as receive data. (usefull for
376 * testing; change: CLOSE necessary)
378 #define DISABLE_HARD_ERROR 0x0040 /* On HARD_ERROR & TRANSMIT_BEACON
379 * no RING.STATUS interrupt.
381 #define DISABLE_SOFT_ERROR 0x0020 /* On SOFT_ERROR, no RING.STATUS
382 * interrupt.
384 #define PASS_ADAPTER_MAC_FRAMES 0x0010 /* Passing unsupported MAC frames
385 * to system.
387 #define PASS_ATTENTION_FRAMES 0x0008 /* All changed attention MAC frames are
388 * passed to the system.
390 #define PAD_ROUTING_FIELD 0x0004 /* Routing field is padded to 18
391 * bytes.
393 #define FRAME_HOLD 0x0002 /* Adapter waits for entire frame before
394 * initiating DMA transfer; otherwise:
395 * DMA transfer initiation if internal
396 * buffer filled.
398 #define CONTENDER 0x0001 /* Adapter participates in the monitor
399 * contention process.
401 #define PASS_BEACON_MAC_FRAMES 0x8000 /* Adapter passes beacon MAC frames
402 * to the system.
404 #define EARLY_TOKEN_RELEASE 0x1000 /* Only valid in 16 Mbps operation;
405 * 0 = ETR. (no effect in 4 Mbps
406 * operation)
408 #define COPY_ALL_MAC_FRAMES 0x0400 /* All MAC frames are copied to
409 * the system. (after OPEN: duplicate
410 * address test (DAT) MAC frame is
411 * first received frame copied to the
412 * system)
414 #define COPY_ALL_NON_MAC_FRAMES 0x0200 /* All non MAC frames are copied to
415 * the system.
417 #define PASS_FIRST_BUF_ONLY 0x0100 /* Passes only first internal buffer
418 * of each received frame; FrameSize
419 * of RPLs must contain internal
420 * BUFFER_SIZE bits for promiscous mode.
422 #define ENABLE_FULL_DUPLEX_SELECTION 0x2000 /* Enable the use of full-duplex
423 * settings with bits in byte 22 in
424 * ocpl. (new feature in firmware
425 * version 3.09)
428 /* Full-duplex settings */
429 #define OPEN_FULL_DUPLEX_OFF 0x0000
430 #define OPEN_FULL_DUPLEX_ON 0x00c0
431 #define OPEN_FULL_DUPLEX_AUTO 0x0080
433 #define PROD_ID_SIZE 18 /* Length of product ID. */
435 #define TX_FRAG_NUM 3 /* Number of fragments used in one TPL. */
436 #define TX_MORE_FRAGMENTS 0x8000 /* Bit set in DataCount to indicate more
437 * fragments following.
440 #define ISA_MAX_ADDRESS 0x00ffffff
442 #pragma pack(1)
443 typedef struct {
444 unsigned short OPENOptions;
445 unsigned char NodeAddr[6]; /* Adapter node address; use ROM
446 * address
448 unsigned long GroupAddr; /* Multicast: high order
449 * bytes = 0xC000
451 unsigned long FunctAddr; /* High order bytes = 0xC000 */
452 unsigned short RxListSize; /* RPL size: 0 (=26), 14, 20 or
453 * 26 bytes read by the adapter.
454 * (Depending on the number of
455 * fragments/list)
457 unsigned short TxListSize; /* TPL size */
458 unsigned short BufSize; /* Is automatically rounded up to the
459 * nearest nK boundary.
461 unsigned short FullDuplex;
462 unsigned short Reserved;
463 unsigned char TXBufMin; /* Number of adapter buffers reserved
464 * for transmission a minimum of 2
465 * buffers must be allocated.
467 unsigned char TXBufMax; /* Maximum number of adapter buffers
468 * for transmit; a minimum of 2 buffers
469 * must be available for receive.
470 * Default: 6
472 unsigned short ProdIDAddr[2]; /* Pointer to product ID. */
473 } OPB, *OPB_Ptr;
474 #pragma pack()
477 * SCB: adapter commands enabled by the host system started by writing
478 * CMD_INTERRUPT_ADAPTER | CMD_EXECUTE (|SCB_REQUEST) to the SIFCMD IO
479 * register. (special case: | CMD_SYSTEM_IRQ for initialization)
481 #pragma pack(1)
482 typedef struct {
483 unsigned short CMD; /* Command code */
484 unsigned short Parm[2]; /* Pointer to Command Parameter Block */
485 } SCB; /* System Command Block (32 bit physical address; big endian)*/
486 #pragma pack()
489 * SSB: adapter command return status can be evaluated after COMMAND_STATUS
490 * adapter to system interrupt after reading SSB, the availability of the SSB
491 * has to be told the adapter by writing CMD_INTERRUPT_ADAPTER | CMD_SSB_CLEAR
492 * in the SIFCMD IO register.
494 #pragma pack(1)
495 typedef struct {
496 unsigned short STS; /* Status code */
497 unsigned short Parm[3]; /* Parameter or pointer to Status Parameter
498 * Block.
500 } SSB; /* System Status Block (big endian - physical address) */
501 #pragma pack()
503 typedef struct {
504 unsigned short BurnedInAddrPtr; /* Pointer to adapter burned in
505 * address. (BIA)
507 unsigned short SoftwareLevelPtr;/* Pointer to software level data. */
508 unsigned short AdapterAddrPtr; /* Pointer to adapter addresses. */
509 unsigned short AdapterParmsPtr; /* Pointer to adapter parameters. */
510 unsigned short MACBufferPtr; /* Pointer to MAC buffer. (internal) */
511 unsigned short LLCCountersPtr; /* Pointer to LLC counters. */
512 unsigned short SpeedFlagPtr; /* Pointer to data rate flag.
513 * (4/16 Mbps)
515 unsigned short AdapterRAMPtr; /* Pointer to adapter RAM found. (KB) */
516 } INTPTRS; /* Adapter internal pointers */
518 #pragma pack(1)
519 typedef struct {
520 unsigned char Line_Error; /* Line error: code violation in
521 * frame or in a token, or FCS error.
523 unsigned char Internal_Error; /* IBM specific. (Reserved_1) */
524 unsigned char Burst_Error;
525 unsigned char ARI_FCI_Error; /* ARI/FCI bit zero in AMP or
526 * SMP MAC frame.
528 unsigned char AbortDelimeters; /* IBM specific. (Reserved_2) */
529 unsigned char Reserved_3;
530 unsigned char Lost_Frame_Error; /* Receive of end of transmitted
531 * frame failed.
533 unsigned char Rx_Congest_Error; /* Adapter in repeat mode has not
534 * enough buffer space to copy incoming
535 * frame.
537 unsigned char Frame_Copied_Error;/* ARI bit not zero in frame
538 * addressed to adapter.
540 unsigned char Frequency_Error; /* IBM specific. (Reserved_4) */
541 unsigned char Token_Error; /* (active only in monitor station) */
542 unsigned char Reserved_5;
543 unsigned char DMA_Bus_Error; /* DMA bus errors not exceeding the
544 * abort thresholds.
546 unsigned char DMA_Parity_Error; /* DMA parity errors not exceeding
547 * the abort thresholds.
549 } ERRORTAB; /* Adapter error counters */
550 #pragma pack()
553 /*--------------------- Send and Receive definitions -------------------*/
554 #pragma pack(1)
555 typedef struct {
556 unsigned short DataCount; /* Value 0, even and odd values are
557 * permitted; value is unaltered most
558 * significant bit set: following
559 * fragments last fragment: most
560 * significant bit is not evaluated.
561 * (???)
563 unsigned long DataAddr; /* Pointer to frame data fragment;
564 * even or odd.
566 } Fragment;
567 #pragma pack()
569 #define MAX_FRAG_NUMBERS 9 /* Maximal number of fragments possible to use
570 * in one RPL/TPL. (depending on TI firmware
571 * version)
573 #define MAX_TX_QUEUE 10 /* Maximal number of skb's queued in driver. */
576 * AC (1), FC (1), Dst (6), Src (6), RIF (18), Data (4472) = 4504
577 * The packet size can be one of the follows: 548, 1502, 2084, 4504, 8176,
578 * 11439, 17832. Refer to TMS380 Second Generation Token Ring User's Guide
579 * Page 2-27.
581 #define HEADER_SIZE (1 + 1 + 6 + 6)
582 #define SRC_SIZE 18
583 #define MIN_DATA_SIZE 516
584 #define DEFAULT_DATA_SIZE 4472
585 #define MAX_DATA_SIZE 17800
587 #define DEFAULT_PACKET_SIZE (HEADER_SIZE + SRC_SIZE + DEFAULT_DATA_SIZE)
588 #define MIN_PACKET_SIZE (HEADER_SIZE + SRC_SIZE + MIN_DATA_SIZE)
589 #define MAX_PACKET_SIZE (HEADER_SIZE + SRC_SIZE + MAX_DATA_SIZE)
592 * Macros to deal with the frame status field.
594 #define AC_NOT_RECOGNIZED 0x00
595 #define GROUP_BIT 0x80
596 #define GET_TRANSMIT_STATUS_HIGH_BYTE(Ts) ((unsigned char)((Ts) >> 8))
597 #define GET_FRAME_STATUS_HIGH_AC(Fs) ((unsigned char)(((Fs) & 0xC0) >> 6))
598 #define GET_FRAME_STATUS_LOW_AC(Fs) ((unsigned char)(((Fs) & 0x0C) >> 2))
599 #define DIRECTED_FRAME(Context) (!((Context)->MData[2] & GROUP_BIT))
602 /*--------------------- Send Functions ---------------------------------*/
603 /* define TX_CSTAT _REQUEST (R) and _COMPLETE (C) values (high-low) */
605 #define TX_VALID 0x0080 /* R: set via TRANSMIT.VALID interrupt.
606 * C: always reset to zero!
608 #define TX_FRAME_COMPLETE 0x0040 /* R: must be reset to zero.
609 * C: set to one.
611 #define TX_START_FRAME 0x0020 /* R: start of a frame: 1
612 * C: unchanged.
614 #define TX_END_FRAME 0x0010 /* R: end of a frame: 1
615 * C: unchanged.
617 #define TX_FRAME_IRQ 0x0008 /* R: request interrupt generation
618 * after transmission.
619 * C: unchanged.
621 #define TX_ERROR 0x0004 /* R: reserved.
622 * C: set to one if Error occurred.
624 #define TX_INTERFRAME_WAIT 0x0004
625 #define TX_PASS_CRC 0x0002 /* R: set if CRC value is already
626 * calculated. (valid only in
627 * FRAME_START TPL)
628 * C: unchanged.
630 #define TX_PASS_SRC_ADDR 0x0001 /* R: adapter uses explicit frame
631 * source address and does not overwrite
632 * with the adapter node address.
633 * (valid only in FRAME_START TPL)
635 * C: unchanged.
637 #define TX_STRIP_FS 0xFF00 /* R: reserved.
638 * C: if no Transmission Error,
639 * field contains copy of FS byte after
640 * stripping of frame.
644 * Structure of Transmit Parameter Lists (TPLs) (only one frame every TPL,
645 * but possibly multiple TPLs for one frame) the length of the TPLs has to be
646 * initialized in the OPL. (OPEN parameter list)
648 #define TPL_NUM 9 /* Number of Transmit Parameter Lists.
649 * !! MUST BE >= 3 !!
652 #pragma pack(1)
653 typedef struct s_TPL TPL;
655 struct s_TPL { /* Transmit Parameter List (align on even word boundaries) */
656 unsigned long NextTPLAddr; /* Pointer to next TPL in chain; if
657 * pointer is odd: this is the last
658 * TPL. Pointing to itself can cause
659 * problems!
661 volatile unsigned short Status; /* Initialized by the adapter:
662 * CSTAT_REQUEST important: update least
663 * significant bit first! Set by the
664 * adapter: CSTAT_COMPLETE status.
666 unsigned short FrameSize; /* Number of bytes to be transmitted
667 * as a frame including AC/FC,
668 * Destination, Source, Routing field
669 * not including CRC, FS, End Delimiter
670 * (valid only if START_FRAME bit in
671 * CSTAT nonzero) must not be zero in
672 * any list; maximum value: (BUFFER_SIZE
673 * - 8) * TX_BUF_MAX sum of DataCount
674 * values in FragmentList must equal
675 * Frame_Size value in START_FRAME TPL!
676 * frame data fragment list.
679 /* TPL/RPL size in OPEN parameter list depending on maximal
680 * numbers of fragments used in one parameter list.
682 Fragment FragList[TX_FRAG_NUM]; /* Maximum: nine frame fragments in one
683 * TPL actual version of firmware: 9
684 * fragments possible.
686 #pragma pack()
688 /* Special proprietary data and precalculations */
690 TPL *NextTPLPtr; /* Pointer to next TPL in chain. */
691 unsigned char *MData;
692 struct sk_buff *Skb;
693 unsigned char TPLIndex;
694 volatile unsigned char BusyFlag;/* Flag: TPL busy? */
697 /* ---------------------Receive Functions-------------------------------*
698 * define RECEIVE_CSTAT_REQUEST (R) and RECEIVE_CSTAT_COMPLETE (C) values.
699 * (high-low)
701 #define RX_VALID 0x0080 /* R: set; tell adapter with
702 * RECEIVE.VALID interrupt.
703 * C: reset to zero.
705 #define RX_FRAME_COMPLETE 0x0040 /* R: must be reset to zero,
706 * C: set to one.
708 #define RX_START_FRAME 0x0020 /* R: must be reset to zero.
709 * C: set to one on the list.
711 #define RX_END_FRAME 0x0010 /* R: must be reset to zero.
712 * C: set to one on the list
713 * that ends the frame.
715 #define RX_FRAME_IRQ 0x0008 /* R: request interrupt generation
716 * after receive.
717 * C: unchanged.
719 #define RX_INTERFRAME_WAIT 0x0004 /* R: after receiving a frame:
720 * interrupt and wait for a
721 * RECEIVE.CONTINUE.
722 * C: unchanged.
724 #define RX_PASS_CRC 0x0002 /* R: if set, the adapter includes
725 * the CRC in data passed. (last four
726 * bytes; valid only if FRAME_START is
727 * set)
728 * C: set, if CRC is included in
729 * received data.
731 #define RX_PASS_SRC_ADDR 0x0001 /* R: adapter uses explicit frame
732 * source address and does not
733 * overwrite with the adapter node
734 * address. (valid only if FRAME_START
735 * is set)
736 * C: unchanged.
738 #define RX_RECEIVE_FS 0xFC00 /* R: reserved; must be reset to zero.
739 * C: on lists with START_FRAME, field
740 * contains frame status field from
741 * received frame; otherwise cleared.
743 #define RX_ADDR_MATCH 0x0300 /* R: reserved; must be reset to zero.
744 * C: address match code mask.
746 #define RX_STATUS_MASK 0x00FF /* Mask for receive status bits. */
748 #define RX_INTERN_ADDR_MATCH 0x0100 /* C: internally address match. */
749 #define RX_EXTERN_ADDR_MATCH 0x0200 /* C: externally matched via
750 * XMATCH/XFAIL interface.
752 #define RX_INTEXT_ADDR_MATCH 0x0300 /* C: internally and externally
753 * matched.
755 #define RX_READY (RX_VALID | RX_FRAME_IRQ) /* Ready for receive. */
757 /* Constants for Command Status Interrupt.
758 * COMMAND_REJECT status field bit functions (SSB.Parm[0])
760 #define ILLEGAL_COMMAND 0x0080 /* Set if an unknown command
761 * is issued to the adapter
763 #define ADDRESS_ERROR 0x0040 /* Set if any address field in
764 * the SCB is odd. (not word aligned)
766 #define ADAPTER_OPEN 0x0020 /* Command issued illegal with
767 * open adapter.
769 #define ADAPTER_CLOSE 0x0010 /* Command issued illegal with
770 * closed adapter.
772 #define SAME_COMMAND 0x0008 /* Command issued with same command
773 * already executing.
776 /* OPEN_COMPLETION values (SSB.Parm[0], MSB) */
777 #define NODE_ADDR_ERROR 0x0040 /* Wrong address or BIA read
778 * zero address.
780 #define LIST_SIZE_ERROR 0x0020 /* If List_Size value not in 0,
781 * 14, 20, 26.
783 #define BUF_SIZE_ERROR 0x0010 /* Not enough available memory for
784 * two buffers.
786 #define TX_BUF_COUNT_ERROR 0x0004 /* Remaining receive buffers less than
787 * two.
789 #define OPEN_ERROR 0x0002 /* Error during ring insertion; more
790 * information in bits 8-15.
793 /* Standard return codes */
794 #define GOOD_COMPLETION 0x0080 /* =OPEN_SUCCESSFULL */
795 #define INVALID_OPEN_OPTION 0x0001 /* OPEN options are not supported by
796 * the adapter.
799 /* OPEN phases; details of OPEN_ERROR (SSB.Parm[0], LSB) */
800 #define OPEN_PHASES_MASK 0xF000 /* Check only the bits 8-11. */
801 #define LOBE_MEDIA_TEST 0x1000
802 #define PHYSICAL_INSERTION 0x2000
803 #define ADDRESS_VERIFICATION 0x3000
804 #define PARTICIPATION_IN_RING_POLL 0x4000
805 #define REQUEST_INITIALISATION 0x5000
806 #define FULLDUPLEX_CHECK 0x6000
808 /* OPEN error codes; details of OPEN_ERROR (SSB.Parm[0], LSB) */
809 #define OPEN_ERROR_CODES_MASK 0x0F00 /* Check only the bits 12-15. */
810 #define OPEN_FUNCTION_FAILURE 0x0100 /* Unable to transmit to itself or
811 * frames received before insertion.
813 #define OPEN_SIGNAL_LOSS 0x0200 /* Signal loss condition detected at
814 * receiver.
816 #define OPEN_TIMEOUT 0x0500 /* Insertion timer expired before
817 * logical insertion.
819 #define OPEN_RING_FAILURE 0x0600 /* Unable to receive own ring purge
820 * MAC frames.
822 #define OPEN_RING_BEACONING 0x0700 /* Beacon MAC frame received after
823 * ring insertion.
825 #define OPEN_DUPLICATE_NODEADDR 0x0800 /* Other station in ring found
826 * with the same address.
828 #define OPEN_REQUEST_INIT 0x0900 /* RPS present but does not respond. */
829 #define OPEN_REMOVE_RECEIVED 0x0A00 /* Adapter received a remove adapter
830 * MAC frame.
832 #define OPEN_FULLDUPLEX_SET 0x0D00 /* Got this with full duplex on when
833 * trying to connect to a normal ring.
836 /* SET_BRIDGE_PARMS return codes: */
837 #define BRIDGE_INVALID_MAX_LEN 0x4000 /* MAX_ROUTING_FIELD_LENGTH odd,
838 * less than 6 or > 30.
840 #define BRIDGE_INVALID_SRC_RING 0x2000 /* SOURCE_RING number zero, too large
841 * or = TARGET_RING.
843 #define BRIDGE_INVALID_TRG_RING 0x1000 /* TARGET_RING number zero, too large
844 * or = SOURCE_RING.
846 #define BRIDGE_INVALID_BRDGE_NO 0x0800 /* BRIDGE_NUMBER too large. */
847 #define BRIDGE_INVALID_OPTIONS 0x0400 /* Invalid bridge options. */
848 #define BRIDGE_DIAGS_FAILED 0x0200 /* Diagnostics of TMS380SRA failed. */
849 #define BRIDGE_NO_SRA 0x0100 /* The TMS380SRA does not exist in HW
850 * configuration.
854 * Bring Up Diagnostics error codes.
856 #define BUD_INITIAL_ERROR 0x0
857 #define BUD_CHECKSUM_ERROR 0x1
858 #define BUD_ADAPTER_RAM_ERROR 0x2
859 #define BUD_INSTRUCTION_ERROR 0x3
860 #define BUD_CONTEXT_ERROR 0x4
861 #define BUD_PROTOCOL_ERROR 0x5
862 #define BUD_INTERFACE_ERROR 0x6
864 /* BUD constants */
865 #define BUD_MAX_RETRIES 3
866 #define BUD_MAX_LOOPCNT 6
867 #define BUD_TIMEOUT 3000
869 /* Initialization constants */
870 #define INIT_MAX_RETRIES 3 /* Maximum three retries. */
871 #define INIT_MAX_LOOPCNT 22 /* Maximum loop counts. */
873 /* RING STATUS field values (high/low) */
874 #define SIGNAL_LOSS 0x0080 /* Loss of signal on the ring
875 * detected.
877 #define HARD_ERROR 0x0040 /* Transmitting or receiving beacon
878 * frames.
880 #define SOFT_ERROR 0x0020 /* Report error MAC frame
881 * transmitted.
883 #define TRANSMIT_BEACON 0x0010 /* Transmitting beacon frames on the
884 * ring.
886 #define LOBE_WIRE_FAULT 0x0008 /* Open or short circuit in the
887 * cable to concentrator; adapter
888 * closed.
890 #define AUTO_REMOVAL_ERROR 0x0004 /* Lobe wrap test failed, deinserted;
891 * adapter closed.
893 #define REMOVE_RECEIVED 0x0001 /* Received a remove ring station MAC
894 * MAC frame request; adapter closed.
896 #define COUNTER_OVERFLOW 0x8000 /* Overflow of one of the adapters
897 * error counters; READ.ERROR.LOG.
899 #define SINGLE_STATION 0x4000 /* Adapter is the only station on the
900 * ring.
902 #define RING_RECOVERY 0x2000 /* Claim token MAC frames on the ring;
903 * reset after ring purge frame.
906 #define ADAPTER_CLOSED (LOBE_WIRE_FAULT | AUTO_REMOVAL_ERROR |\
907 REMOVE_RECEIVED)
909 /* Adapter_check_block.Status field bit assignments: */
910 #define DIO_PARITY 0x8000 /* Adapter detects bad parity
911 * through direct I/O access.
913 #define DMA_READ_ABORT 0x4000 /* Aborting DMA read operation
914 * from system Parm[0]: 0=timeout,
915 * 1=parity error, 2=bus error;
916 * Parm[1]: 32 bit pointer to host
917 * system address at failure.
919 #define DMA_WRITE_ABORT 0x2000 /* Aborting DMA write operation
920 * to system. (parameters analogous to
921 * DMA_READ_ABORT)
923 #define ILLEGAL_OP_CODE 0x1000 /* Illegal operation code in the
924 * the adapters firmware Parm[0]-2:
925 * communications processor registers
926 * R13-R15.
928 #define PARITY_ERRORS 0x0800 /* Adapter detects internal bus
929 * parity error.
931 #define RAM_DATA_ERROR 0x0080 /* Valid only during RAM testing;
932 * RAM data error Parm[0-1]: 32 bit
933 * pointer to RAM location.
935 #define RAM_PARITY_ERROR 0x0040 /* Valid only during RAM testing;
936 * RAM parity error Parm[0-1]: 32 bit
937 * pointer to RAM location.
939 #define RING_UNDERRUN 0x0020 /* Internal DMA underrun when
940 * transmitting onto ring.
942 #define INVALID_IRQ 0x0008 /* Unrecognized interrupt generated
943 * internal to adapter Parm[0-2]:
944 * adapter register R13-R15.
946 #define INVALID_ERROR_IRQ 0x0004 /* Unrecognized error interrupt
947 * generated Parm[0-2]: adapter register
948 * R13-R15.
950 #define INVALID_XOP 0x0002 /* Unrecognized XOP request in
951 * communication processor Parm[0-2]:
952 * adapter register R13-R15.
954 #define CHECKADDR 0x05E0 /* Adapter check status information
955 * address offset.
957 #define ROM_PAGE_0 0x0000 /* Adapter ROM page 0. */
960 * RECEIVE.STATUS interrupt result SSB values: (high-low)
961 * (RECEIVE_COMPLETE field bit definitions in SSB.Parm[0])
963 #define RX_COMPLETE 0x0080 /* SSB.Parm[0]; SSB.Parm[1]: 32
964 * bit pointer to last RPL.
966 #define RX_SUSPENDED 0x0040 /* SSB.Parm[0]; SSB.Parm[1]: 32
967 * bit pointer to RPL with odd
968 * forward pointer.
971 /* Valid receive CSTAT: */
972 #define RX_FRAME_CONTROL_BITS (RX_VALID | RX_START_FRAME | RX_END_FRAME | \
973 RX_FRAME_COMPLETE)
974 #define VALID_SINGLE_BUFFER_FRAME (RX_START_FRAME | RX_END_FRAME | \
975 RX_FRAME_COMPLETE)
977 typedef enum SKB_STAT SKB_STAT;
978 enum SKB_STAT {
979 SKB_UNAVAILABLE,
980 SKB_DMA_DIRECT,
981 SKB_DATA_COPY
984 /* Receive Parameter List (RPL) The length of the RPLs has to be initialized
985 * in the OPL. (OPEN parameter list)
987 #define RPL_NUM 3
989 #define RX_FRAG_NUM 1 /* Maximal number of used fragments in one RPL.
990 * (up to firmware v2.24: 3, now: up to 9)
993 #pragma pack(1)
994 typedef struct s_RPL RPL;
995 struct s_RPL { /* Receive Parameter List */
996 unsigned long NextRPLAddr; /* Pointer to next RPL in chain
997 * (normalized = physical 32 bit
998 * address) if pointer is odd: this
999 * is last RPL. Pointing to itself can
1000 * cause problems!
1002 volatile unsigned short Status; /* Set by creation of Receive Parameter
1003 * List RECEIVE_CSTAT_COMPLETE set by
1004 * adapter in lists that start or end
1005 * a frame.
1007 volatile unsigned short FrameSize; /* Number of bytes received as a
1008 * frame including AC/FC, Destination,
1009 * Source, Routing field not including
1010 * CRC, FS (Frame Status), End Delimiter
1011 * (valid only if START_FRAME bit in
1012 * CSTAT nonzero) must not be zero in
1013 * any list; maximum value: (BUFFER_SIZE
1014 * - 8) * TX_BUF_MAX sum of DataCount
1015 * values in FragmentList must equal
1016 * Frame_Size value in START_FRAME TPL!
1017 * frame data fragment list
1020 /* TPL/RPL size in OPEN parameter list depending on maximal numbers
1021 * of fragments used in one parameter list.
1023 Fragment FragList[RX_FRAG_NUM]; /* Maximum: nine frame fragments in
1024 * one TPL. Actual version of firmware:
1025 * 9 fragments possible.
1027 #pragma pack()
1029 /* Special proprietary data and precalculations. */
1030 RPL *NextRPLPtr; /* Logical pointer to next RPL in chain. */
1031 unsigned char *MData;
1032 struct sk_buff *Skb;
1033 SKB_STAT SkbStat;
1034 int RPLIndex;
1037 /* Information that need to be kept for each board. */
1038 typedef struct net_local {
1039 #pragma pack(1)
1040 IPB ipb; /* Initialization Parameter Block. */
1041 SCB scb; /* System Command Block: system to adapter
1042 * communication.
1044 SSB ssb; /* System Status Block: adapter to system
1045 * communication.
1047 OPB ocpl; /* Open Options Parameter Block. */
1049 ERRORTAB errorlogtable; /* Adapter statistic error counters.
1050 * (read from adapter memory)
1052 unsigned char ProductID[PROD_ID_SIZE + 1]; /* Product ID */
1053 #pragma pack()
1055 TPL Tpl[TPL_NUM];
1056 TPL *TplFree;
1057 TPL *TplBusy;
1058 unsigned char LocalTxBuffers[TPL_NUM][DEFAULT_PACKET_SIZE];
1060 RPL Rpl[RPL_NUM];
1061 RPL *RplHead;
1062 RPL *RplTail;
1063 unsigned char LocalRxBuffers[RPL_NUM][DEFAULT_PACKET_SIZE];
1065 int DataRate;
1066 unsigned char ScbInUse;
1067 unsigned short CMDqueue;
1069 unsigned int DeviceType;
1071 unsigned long AdapterOpenFlag:1;
1072 unsigned long AdapterVirtOpenFlag:1;
1073 unsigned long OpenCommandIssued:1;
1074 unsigned long TransmitCommandActive:1;
1075 unsigned long TransmitHaltScheduled:1;
1076 unsigned long HaltInProgress:1;
1077 unsigned long LobeWireFaultLogged:1;
1078 unsigned long ReOpenInProgress:1;
1079 unsigned long Sleeping:1;
1081 unsigned long LastOpenStatus;
1082 unsigned short CurrentRingStatus;
1083 unsigned long MaxPacketSize;
1085 unsigned long StartTime;
1086 unsigned long LastSendTime;
1088 struct sk_buff_head SendSkbQueue;
1089 unsigned short QueueSkb;
1091 struct tr_statistics MacStat; /* MAC statistics structure */
1093 struct timer_list timer;
1095 wait_queue_head_t wait_for_tok_int;
1097 INTPTRS intptrs; /* Internal adapter pointer. Must be read
1098 * before OPEN command.
1100 } NET_LOCAL;
1102 #endif /* __KERNEL__ */
1103 #endif /* __LINUX_SKTR_H */