Import 2.3.18pre1
[davej-history.git] / drivers / net / olympic.h
blobd5a06423abcf71334f1ff7c79e793e56177e337c
1 /*
2 * olympic.h (c) 1999 Peter De Schrijver All Rights Reserved
3 * 1999 Mike Phillips (phillim@amtrak.com)
5 * Linux driver for IBM PCI tokenring cards based on the olympic and the PIT/PHY chipset.
7 * Base Driver Skeleton:
8 * Written 1993-94 by Donald Becker.
10 * Copyright 1993 United States Government as represented by the
11 * Director, National Security Agency.
13 * This software may be used and distributed according to the terms
14 * of the GNU Public License, incorporated herein by reference.
17 #define CID 0x4e
19 #define BCTL 0x70
20 #define BCTL_SOFTRESET (1<<15)
21 #define BCTL_MIMREB (1<<6)
23 #define GPR 0x4a
24 #define GPR_OPTI_BF (1<<6)
25 #define GPR_NEPTUNE_BF (1<<4)
26 #define GPR_AUTOSENSE (1<<2)
27 #define GPR_16MBPS (1<<3)
29 #define PAG 0x85
30 #define LBC 0x8e
32 #define LISR 0x10
33 #define LISR_SUM 0x14
34 #define LISR_RWM 0x18
36 #define LISR_LIE (1<<15)
37 #define LISR_SLIM (1<<13)
38 #define LISR_SLI (1<<12)
39 #define LISR_PCMSRMASK (1<<11)
40 #define LISR_PCMSRINT (1<<10)
41 #define LISR_WOLMASK (1<<9)
42 #define LISR_WOL (1<<8)
43 #define LISR_SRB_CMD (1<<5)
44 #define LISR_ASB_REPLY (1<<4)
45 #define LISR_ASB_FREE_REQ (1<<2)
46 #define LISR_ARB_FREE (1<<1)
47 #define LISR_TRB_FRAME (1<<0)
49 #define SISR 0x20
50 #define SISR_SUM 0x24
51 #define SISR_RWM 0x28
52 #define SISR_RR 0x2C
53 #define SISR_RESMASK 0x30
54 #define SISR_MASK 0x54
55 #define SISR_MASK_SUM 0x58
56 #define SISR_MASK_RWM 0x5C
58 #define SISR_TX2_IDLE (1<<31)
59 #define SISR_TX2_HALT (1<<29)
60 #define SISR_TX2_EOF (1<<28)
61 #define SISR_TX1_IDLE (1<<27)
62 #define SISR_TX1_HALT (1<<25)
63 #define SISR_TX1_EOF (1<<24)
64 #define SISR_TIMEOUT (1<<23)
65 #define SISR_RX_NOBUF (1<<22)
66 #define SISR_RX_STATUS (1<<21)
67 #define SISR_RX_HALT (1<<18)
68 #define SISR_RX_EOF_EARLY (1<<16)
69 #define SISR_MI (1<<15)
70 #define SISR_PI (1<<13)
71 #define SISR_ERR (1<<9)
72 #define SISR_ADAPTER_CHECK (1<<6)
73 #define SISR_SRB_REPLY (1<<5)
74 #define SISR_ASB_FREE (1<<4)
75 #define SISR_ARB_CMD (1<<3)
76 #define SISR_TRB_REPLY (1<<2)
78 #define EISR 0x34
79 #define EISR_RWM 0x38
80 #define EISR_MASK 0x3c
82 #define LAPA 0x60
83 #define LAPWWO 0x64
84 #define LAPWWC 0x68
85 #define LAPCTL 0x6C
86 #define LAIPD 0x78
87 #define LAIPDDINC 0x7C
89 #define TIMER 0x50
91 #define CLKCTL 0x74
93 #define PM_CON 0x4
95 #define BMCTL_SUM 0x40
96 #define BMCTL_RWM 0x44
97 #define BMCTL_TX2_DIS (1<<30)
98 #define BMCTL_TX1_DIS (1<<26)
99 #define BMCTL_RX_DIS (1<<22)
101 #define BMASR 0xcc
103 #define RXDESCQ 0x90
104 #define RXDESCQCNT 0x94
105 #define RXCDA 0x98
106 #define RXENQ 0x9C
107 #define RXSTATQ 0xA0
108 #define RXSTATQCNT 0xA4
109 #define RXCSA 0xA8
110 #define RXCLEN 0xAC
111 #define RXHLEN 0xAE
113 #define TXDESCQ_1 0xb0
114 #define TXDESCQ_2 0xd0
115 #define TXDESCQCNT_1 0xb4
116 #define TXDESCQCNT_2 0xd4
117 #define TXCDA_1 0xb8
118 #define TXCDA_2 0xd8
119 #define TXENQ_1 0xbc
120 #define TXENQ_2 0xdc
121 #define TXSTATQ_1 0xc0
122 #define TXSTATQ_2 0xe0
123 #define TXSTATQCNT_1 0xc4
124 #define TXSTATQCNT_2 0xe4
125 #define TXCSA_1 0xc8
126 #define TXCSA_2 0xe8
128 #define OLYMPIC_IO_SPACE 256
130 #define SRB_COMMAND_SIZE 50
132 #define OLYMPIC_MAX_ADAPTERS 8 /* 0x08 __MODULE_STRING can't hand 0xnn */
134 /* Defines for LAN STATUS CHANGE reports */
135 #define LSC_SIG_LOSS 0x8000
136 #define LSC_HARD_ERR 0x4000
137 #define LSC_SOFT_ERR 0x2000
138 #define LSC_TRAN_BCN 0x1000
139 #define LSC_LWF 0x0800
140 #define LSC_ARW 0x0400
141 #define LSC_FPE 0x0200
142 #define LSC_RR 0x0100
143 #define LSC_CO 0x0080
144 #define LSC_SS 0x0040
145 #define LSC_RING_REC 0x0020
146 #define LSC_SR_CO 0x0010
147 #define LSC_FDX_MODE 0x0004
149 /* Defines for OPEN ADAPTER command */
151 #define OPEN_ADAPTER_EXT_WRAP (1<<15)
152 #define OPEN_ADAPTER_DIS_HARDEE (1<<14)
153 #define OPEN_ADAPTER_DIS_SOFTERR (1<<13)
154 #define OPEN_ADAPTER_PASS_ADC_MAC (1<<12)
155 #define OPEN_ADAPTER_PASS_ATT_MAC (1<<11)
156 #define OPEN_ADAPTER_ENABLE_EC (1<<10)
157 #define OPEN_ADAPTER_CONTENDER (1<<8)
158 #define OPEN_ADAPTER_PASS_BEACON (1<<7)
159 #define OPEN_ADAPTER_ENABLE_FDX (1<<6)
160 #define OPEN_ADAPTER_ENABLE_RPL (1<<5)
161 #define OPEN_ADAPTER_INHIBIT_ETR (1<<4)
162 #define OPEN_ADAPTER_INTERNAL_WRAP (1<<3)
163 #define OPEN_ADAPTER_USE_OPTS2 (1<<0)
165 #define OPEN_ADAPTER_2_ENABLE_ONNOW (1<<15)
167 /* Defines for SRB Commands */
169 #define SRB_ACCESS_REGISTER 0x1f
170 #define SRB_CLOSE_ADAPTER 0x04
171 #define SRB_CONFIGURE_BRIDGE 0x0c
172 #define SRB_CONFIGURE_WAKEUP_EVENT 0x1a
173 #define SRB_MODIFY_BRIDGE_PARMS 0x15
174 #define SRB_MODIFY_OPEN_OPTIONS 0x01
175 #define SRB_MODIFY_RECEIVE_OPTIONS 0x17
176 #define SRB_NO_OPERATION 0x00
177 #define SRB_OPEN_ADAPTER 0x03
178 #define SRB_READ_LOG 0x08
179 #define SRB_READ_SR_COUNTERS 0x16
180 #define SRB_RESET_GROUP_ADDRESS 0x02
181 #define SRB_SAVE_CONFIGURATION 0x1b
182 #define SRB_SET_BRIDGE_PARMS 0x09
183 #define SRB_SET_BRIDGE_TARGETS 0x10
184 #define SRB_SET_FUNC_ADDRESS 0x07
185 #define SRB_SET_GROUP_ADDRESS 0x06
186 #define SRB_SET_GROUP_ADDR_OPTIONS 0x11
187 #define SRB_UPDATE_WAKEUP_PATTERN 0x19
189 /* Clear return code */
191 #define OLYMPIC_CLEAR_RET_CODE 0xfe
193 /* ARB Commands */
194 #define ARB_RECEIVE_DATA 0x81
195 #define ARB_LAN_CHANGE_STATUS 0x84
196 /* ASB Response commands */
198 #define ASB_RECEIVE_DATA 0x81
201 /* Olympic defaults for buffers */
203 #define OLYMPIC_RX_RING_SIZE 16 /* should be a power of 2 */
204 #define OLYMPIC_TX_RING_SIZE 8 /* should be a power of 2 */
206 #define PKT_BUF_SZ 4096 /* Default packet size */
208 /* Olympic data structures */
210 struct olympic_tx_desc {
211 __u32 buffer;
212 __u32 status_length;
215 struct olympic_tx_status {
216 __u32 status;
219 struct olympic_rx_desc {
220 __u32 buffer;
221 __u32 res_length ;
224 struct olympic_rx_status {
225 __u32 fragmentcnt_framelen;
226 __u32 status_buffercnt;
229 struct mac_receive_buffer {
230 __u16 next ;
231 __u8 padding ;
232 __u8 frame_status ;
233 __u16 buffer_length ;
234 __u8 frame_data ;
237 struct olympic_private {
239 __u16 srb;
240 __u16 trb;
241 __u16 arb;
242 __u16 asb;
244 __u8 *olympic_mmio;
245 __u8 *olympic_lap;
246 char *olympic_card_name ;
248 volatile int srb_queued; /* True if an SRB is still posted */
249 wait_queue_head_t srb_wait;
251 volatile int asb_queued; /* True if an ASB is posted */
253 volatile int trb_queued; /* True if a TRB is posted */
254 wait_queue_head_t trb_wait ;
256 struct olympic_rx_desc olympic_rx_ring[OLYMPIC_RX_RING_SIZE];
257 struct olympic_tx_desc olympic_tx_ring[OLYMPIC_TX_RING_SIZE];
258 struct olympic_rx_status olympic_rx_status_ring[OLYMPIC_RX_RING_SIZE];
259 struct olympic_tx_status olympic_tx_status_ring[OLYMPIC_TX_RING_SIZE];
260 struct sk_buff *tx_ring_skb[OLYMPIC_TX_RING_SIZE], *rx_ring_skb[OLYMPIC_RX_RING_SIZE];
261 int tx_ring_free, tx_ring_last_status, rx_ring_last_received,rx_status_last_received, free_tx_ring_entries;
263 struct net_device_stats olympic_stats ;
264 __u16 olympic_lan_status ;
265 __u8 olympic_ring_speed ;
266 __u16 pkt_buf_sz ;
267 __u8 olympic_receive_options, olympic_copy_all_options, olympic_message_level;
268 __u8 olympic_multicast_set ;
269 __u16 olympic_addr_table_addr, olympic_parms_addr ;
270 __u8 olympic_laa[6] ;
273 struct olympic_adapter_addr_table {
275 __u8 node_addr[6] ;
276 __u8 reserved[4] ;
277 __u8 func_addr[4] ;
278 } ;
280 struct olympic_parameters_table {
282 __u8 phys_addr[4] ;
283 __u8 up_node_addr[6] ;
284 __u8 up_phys_addr[6] ;
285 __u8 poll_addr[6] ;
286 __u16 reserved ;
287 __u16 acc_priority ;
288 __u16 auth_source_class ;
289 __u16 att_code ;
290 __u8 source_addr[6] ;
291 __u16 beacon_type ;
292 __u16 major_vector ;
293 __u16 lan_status ;
294 __u16 soft_error_time ;
295 __u16 reserved1 ;
296 __u16 local_ring ;
297 __u16 mon_error ;
298 __u16 beacon_transmit ;
299 __u16 beacon_receive ;
300 __u16 frame_correl ;
301 __u8 beacon_naun[6] ;
302 __u32 reserved2 ;
303 __u8 beacon_phys[4] ;