1 |
1626 |
jcastillo |
/*
|
2 |
|
|
* Wavelan ISA driver
|
3 |
|
|
*
|
4 |
|
|
* Jean II - HPLB '96
|
5 |
|
|
*
|
6 |
|
|
* Reorganisation and extension of the driver.
|
7 |
|
|
*
|
8 |
|
|
* This file contain all definition and declarations necessary for the
|
9 |
|
|
* wavelan isa driver. This file is a private header, so it should
|
10 |
|
|
* be included only on wavelan.c !!!
|
11 |
|
|
*/
|
12 |
|
|
|
13 |
|
|
#ifndef WAVELAN_P_H
|
14 |
|
|
#define WAVELAN_P_H
|
15 |
|
|
|
16 |
|
|
/************************** DOCUMENTATION **************************/
|
17 |
|
|
/*
|
18 |
|
|
* This driver provide a Linux interface to the Wavelan ISA hardware
|
19 |
|
|
* The Wavelan is a product of Lucent ("http://www.wavelan.com/").
|
20 |
|
|
* This division was formerly part of NCR and then AT&T.
|
21 |
|
|
* Wavelan are also distributed by DEC (RoamAbout DS) and Digital Ocean.
|
22 |
|
|
*
|
23 |
|
|
* To know how to use this driver, read the NET3 HOWTO.
|
24 |
|
|
* If you want to exploit the many other fonctionalities, look comments
|
25 |
|
|
* in the code...
|
26 |
|
|
*
|
27 |
|
|
* This driver is the result of the effort of many peoples (see below).
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
/* ------------------------ SPECIFIC NOTES ------------------------ */
|
31 |
|
|
/*
|
32 |
|
|
* Web page
|
33 |
|
|
* --------
|
34 |
|
|
* I try to maintain a web page with the Wireless LAN Howto at :
|
35 |
|
|
* http://www-uk.hpl.hp.com/people/jt/Linux/Wavelan.html
|
36 |
|
|
*
|
37 |
|
|
* wavelan.o is darn too big
|
38 |
|
|
* -------------------------
|
39 |
|
|
* That's true ! There is a very simple way to reduce the driver
|
40 |
|
|
* object by 33% (yes !). Comment out the following line :
|
41 |
|
|
* #include <linux/wireless.h>
|
42 |
|
|
*
|
43 |
|
|
* Debugging and options
|
44 |
|
|
* ---------------------
|
45 |
|
|
* You will find below a set of '#define" allowing a very fine control
|
46 |
|
|
* on the driver behaviour and the debug messages printed.
|
47 |
|
|
*
|
48 |
|
|
* MAC address and hardware detection :
|
49 |
|
|
* ----------------------------------
|
50 |
|
|
* The detection code of the wavelan chech that the first 3
|
51 |
|
|
* octets of the MAC address fit the company code. This type of
|
52 |
|
|
* detection work well for AT&T cards (because the AT&T code is
|
53 |
|
|
* hardcoded in wavelan.h), but of course will fail for other
|
54 |
|
|
* manufacturer.
|
55 |
|
|
*
|
56 |
|
|
* If you are sure that your card is derived from the wavelan,
|
57 |
|
|
* here is the way to configure it :
|
58 |
|
|
* 1) Get your MAC address
|
59 |
|
|
* a) With your card utilities (wfreqsel, instconf, ...)
|
60 |
|
|
* b) With the driver :
|
61 |
|
|
* o compile the kernel with DEBUG_CONFIG_INFO enabled
|
62 |
|
|
* o Boot and look the card messages
|
63 |
|
|
* 2) Set your MAC code (3 octets) in MAC_ADDRESSES[][3] (wavelan.h)
|
64 |
|
|
* 3) Compile & verify
|
65 |
|
|
* 4) Send me the MAC code - I will include it in the next version...
|
66 |
|
|
*
|
67 |
|
|
*/
|
68 |
|
|
|
69 |
|
|
/* --------------------- WIRELESS EXTENSIONS --------------------- */
|
70 |
|
|
/*
|
71 |
|
|
* This driver is the first one to support "wireless extensions".
|
72 |
|
|
* This set of extensions provide you some way to control the wireless
|
73 |
|
|
* caracteristics of the hardware in a standard way and support for
|
74 |
|
|
* applications for taking advantage of it (like Mobile IP).
|
75 |
|
|
*
|
76 |
|
|
* You will need to enable the CONFIG_NET_RADIO define in the kernel
|
77 |
|
|
* configuration to enable the wireless extensions (this is the one
|
78 |
|
|
* giving access to the radio network device choice).
|
79 |
|
|
*
|
80 |
|
|
* It might also be a good idea as well to fetch the wireless tools to
|
81 |
|
|
* configure the device and play a bit.
|
82 |
|
|
*/
|
83 |
|
|
|
84 |
|
|
/* ---------------------------- FILES ---------------------------- */
|
85 |
|
|
/*
|
86 |
|
|
* wavelan.c : The actual code for the driver - C functions
|
87 |
|
|
*
|
88 |
|
|
* wavelan.p.h : Private header : local types / vars for the driver
|
89 |
|
|
*
|
90 |
|
|
* wavelan.h : Description of the hardware interface & structs
|
91 |
|
|
*
|
92 |
|
|
* i82586.h : Description if the Ethernet controler
|
93 |
|
|
*/
|
94 |
|
|
|
95 |
|
|
/* --------------------------- HISTORY --------------------------- */
|
96 |
|
|
/*
|
97 |
|
|
* (Made with information in drivers headers. It may not be accurate,
|
98 |
|
|
* and I garantee nothing except my best effort...)
|
99 |
|
|
*
|
100 |
|
|
* The history of the Wavelan drivers is as complicated as history of
|
101 |
|
|
* the Wavelan itself (NCR -> AT&T -> Lucent).
|
102 |
|
|
*
|
103 |
|
|
* All started with Anders Klemets <klemets@paul.rutgers.edu>,
|
104 |
|
|
* writting a Wavelan ISA driver for the MACH microkernel. Girish
|
105 |
|
|
* Welling <welling@paul.rutgers.edu> had also worked on it.
|
106 |
|
|
* Keith Moore modify this for the Pcmcia hardware.
|
107 |
|
|
*
|
108 |
|
|
* Robert Morris <rtm@das.harvard.edu> port these two drivers to BSDI
|
109 |
|
|
* and add specific Pcmcia support (there is currently no equivalent
|
110 |
|
|
* of the PCMCIA package under BSD...).
|
111 |
|
|
*
|
112 |
|
|
* Jim Binkley <jrb@cs.pdx.edu> port both BSDI drivers to freeBSD.
|
113 |
|
|
*
|
114 |
|
|
* Bruce Janson <bruce@cs.usyd.edu.au> port the BSDI ISA driver to Linux.
|
115 |
|
|
*
|
116 |
|
|
* Anthony D. Joseph <adj@lcs.mit.edu> started modify Bruce driver
|
117 |
|
|
* (with help of the BSDI PCMCIA driver) for PCMCIA.
|
118 |
|
|
* Yunzhou Li <yunzhou@strat.iol.unh.edu> finished is work.
|
119 |
|
|
* Joe Finney <joe@comp.lancs.ac.uk> patched the driver to start
|
120 |
|
|
* correctly 2.00 cards (2.4 GHz with frequency selection).
|
121 |
|
|
* David Hinds <dhinds@hyper.stanford.edu> integrated the whole in his
|
122 |
|
|
* Pcmcia package (+ bug corrections).
|
123 |
|
|
*
|
124 |
|
|
* I (Jean Tourrilhes - jt@hplb.hpl.hp.com) then started to make some
|
125 |
|
|
* patchs to the Pcmcia driver. After, I added code in the ISA driver
|
126 |
|
|
* for Wireless Extensions and full support of frequency selection
|
127 |
|
|
* cards. Then, I've done the same to the Pcmcia driver + some
|
128 |
|
|
* reorganisation. Finally, I came back to the ISA driver to
|
129 |
|
|
* upgrade it at the same level as the Pcmcia one and reorganise
|
130 |
|
|
* the code
|
131 |
|
|
* Loeke Brederveld <lbrederv@wavelan.com> from Lucent has given me
|
132 |
|
|
* much needed informations on the Wavelan hardware.
|
133 |
|
|
*/
|
134 |
|
|
|
135 |
|
|
/* The original copyrights and litteratures mention others names and
|
136 |
|
|
* credits. I don't know what there part in this development was...
|
137 |
|
|
*/
|
138 |
|
|
|
139 |
|
|
/* By the way : for the copyright & legal stuff :
|
140 |
|
|
* Almost everybody wrote code under GNU or BSD license (or alike),
|
141 |
|
|
* and want that their original copyright remain somewhere in the
|
142 |
|
|
* code (for myself, I go with the GPL).
|
143 |
|
|
* Nobody want to take responsibility for anything, except the fame...
|
144 |
|
|
*/
|
145 |
|
|
|
146 |
|
|
/* --------------------------- CREDITS --------------------------- */
|
147 |
|
|
/*
|
148 |
|
|
* This software was developed as a component of the
|
149 |
|
|
* Linux operating system.
|
150 |
|
|
* It is based on other device drivers and information
|
151 |
|
|
* either written or supplied by:
|
152 |
|
|
* Ajay Bakre (bakre@paul.rutgers.edu),
|
153 |
|
|
* Donald Becker (becker@cesdis.gsfc.nasa.gov),
|
154 |
|
|
* Loeke Brederveld (Loeke.Brederveld@Utrecht.NCR.com),
|
155 |
|
|
* Brent Elphick <belphick@uwaterloo.ca>,
|
156 |
|
|
* Anders Klemets (klemets@it.kth.se),
|
157 |
|
|
* Vladimir V. Kolpakov (w@stier.koenig.ru),
|
158 |
|
|
* Marc Meertens (Marc.Meertens@Utrecht.NCR.com),
|
159 |
|
|
* Pauline Middelink (middelin@polyware.iaf.nl),
|
160 |
|
|
* Robert Morris (rtm@das.harvard.edu),
|
161 |
|
|
* Jean Tourrilhes (jt@hplb.hpl.hp.com),
|
162 |
|
|
* Girish Welling (welling@paul.rutgers.edu),
|
163 |
|
|
* Clark Woodworth <clark@hiway1.exit109.com>
|
164 |
|
|
* Yongguang Zhang <ygz@isl.hrl.hac.com>...
|
165 |
|
|
*
|
166 |
|
|
* Thanks go also to:
|
167 |
|
|
* James Ashton (jaa101@syseng.anu.edu.au),
|
168 |
|
|
* Alan Cox (iialan@iiit.swan.ac.uk),
|
169 |
|
|
* Allan Creighton (allanc@cs.usyd.edu.au),
|
170 |
|
|
* Matthew Geier (matthew@cs.usyd.edu.au),
|
171 |
|
|
* Remo di Giovanni (remo@cs.usyd.edu.au),
|
172 |
|
|
* Eckhard Grah (grah@wrcs1.urz.uni-wuppertal.de),
|
173 |
|
|
* Vipul Gupta (vgupta@cs.binghamton.edu),
|
174 |
|
|
* Mark Hagan (mhagan@wtcpost.daytonoh.NCR.COM),
|
175 |
|
|
* Tim Nicholson (tim@cs.usyd.edu.au),
|
176 |
|
|
* Ian Parkin (ian@cs.usyd.edu.au),
|
177 |
|
|
* John Rosenberg (johnr@cs.usyd.edu.au),
|
178 |
|
|
* George Rossi (george@phm.gov.au),
|
179 |
|
|
* Arthur Scott (arthur@cs.usyd.edu.au),
|
180 |
|
|
* Stanislav Sinyagin <stas@isf.ru>
|
181 |
|
|
* Peter Storey,
|
182 |
|
|
* for their assistance and advice.
|
183 |
|
|
*
|
184 |
|
|
* Additional Credits:
|
185 |
|
|
*
|
186 |
|
|
* My developpement has been done under Linux 2.0.x (Debian 1.1) with
|
187 |
|
|
* an HP Vectra XP/60.
|
188 |
|
|
*
|
189 |
|
|
*/
|
190 |
|
|
|
191 |
|
|
/* ------------------------- IMPROVEMENTS ------------------------- */
|
192 |
|
|
/*
|
193 |
|
|
* I proudly present :
|
194 |
|
|
*
|
195 |
|
|
* Changes mades in first pre-release :
|
196 |
|
|
* ----------------------------------
|
197 |
|
|
* - Reorganisation of the code, function name change
|
198 |
|
|
* - Creation of private header (wavelan.p.h)
|
199 |
|
|
* - Reorganised debug messages
|
200 |
|
|
* - More comments, history, ...
|
201 |
|
|
* - mmc_init : configure the PSA if not done
|
202 |
|
|
* - mmc_init : correct default value of level threshold for pcmcia
|
203 |
|
|
* - mmc_init : 2.00 detection better code for 2.00 init
|
204 |
|
|
* - better info at startup
|
205 |
|
|
* - irq setting (note : this setting is permanent...)
|
206 |
|
|
* - Watchdog : change strategy (+ solve module removal problems)
|
207 |
|
|
* - add wireless extensions (ioctl & get_wireless_stats)
|
208 |
|
|
* get/set nwid/frequency on fly, info for /proc/net/wireless
|
209 |
|
|
* - More wireless extension : SETSPY and GETSPY
|
210 |
|
|
* - Make wireless extensions optional
|
211 |
|
|
* - Private ioctl to set/get quality & level threshold, histogram
|
212 |
|
|
* - Remove /proc/net/wavelan
|
213 |
|
|
* - Supress useless stuff from lp (net_local)
|
214 |
|
|
* - kernel 2.1 support (copy_to/from_user instead of memcpy_to/fromfs)
|
215 |
|
|
* - Add message level (debug stuff in /var/adm/debug & errors not
|
216 |
|
|
* displayed at console and still in /var/adm/messages)
|
217 |
|
|
* - multi device support
|
218 |
|
|
* - Start fixing the probe (init code)
|
219 |
|
|
* - More inlines
|
220 |
|
|
* - man page
|
221 |
|
|
* - Lot of others minor details & cleanups
|
222 |
|
|
*
|
223 |
|
|
* Changes made in second pre-release :
|
224 |
|
|
* ----------------------------------
|
225 |
|
|
* - Cleanup init code (probe & module init)
|
226 |
|
|
* - Better multi device support (module)
|
227 |
|
|
* - name assignement (module)
|
228 |
|
|
*
|
229 |
|
|
* Changes made in third pre-release :
|
230 |
|
|
* ---------------------------------
|
231 |
|
|
* - Be more conservative on timers
|
232 |
|
|
* - Preliminary support for multicast (I still lack some details...)
|
233 |
|
|
*
|
234 |
|
|
* Changes made in fourth pre-release :
|
235 |
|
|
* ----------------------------------
|
236 |
|
|
* - multicast (revisited and finished)
|
237 |
|
|
* - Avoid reset in set_multicast_list (a really big hack)
|
238 |
|
|
* if somebody could apply this code for other i82586 based driver...
|
239 |
|
|
* - Share on board memory 75% RU / 25% CU (instead of 50/50)
|
240 |
|
|
*
|
241 |
|
|
* Changes made for release in 2.1.15 :
|
242 |
|
|
* ----------------------------------
|
243 |
|
|
* - Change the detection code for multi manufacturer code support
|
244 |
|
|
*
|
245 |
|
|
* Changes made for release in 2.1.17 :
|
246 |
|
|
* ----------------------------------
|
247 |
|
|
* - Update to wireless extensions changes
|
248 |
|
|
* - Silly bug in card initial configuration (psa_conf_status)
|
249 |
|
|
*
|
250 |
|
|
* Changes made for release in 2.1.27 & 2.0.30 :
|
251 |
|
|
* -------------------------------------------
|
252 |
|
|
* - Small bug in debug code (probably not the last one...)
|
253 |
|
|
* - Remove extern kerword for wavelan_probe()
|
254 |
|
|
* - Level threshold is now a standard wireless extension (version 4 !)
|
255 |
|
|
*
|
256 |
|
|
* Changes made for release in 2.1.36 :
|
257 |
|
|
* ----------------------------------
|
258 |
|
|
* - Encryption setting from Brent Elphick (thanks a lot !)
|
259 |
|
|
* - 'ioaddr' to 'u_long' for the Alpha (thanks to Stanislav Sinyagin)
|
260 |
|
|
*
|
261 |
|
|
* Other changes (not by me) :
|
262 |
|
|
* -------------------------
|
263 |
|
|
* - Spelling and gramar "rectification".
|
264 |
|
|
*
|
265 |
|
|
* Changes made for release in 2.0.37 & 2.2.2 :
|
266 |
|
|
* ------------------------------------------
|
267 |
|
|
* - Correct status in /proc/net/wireless
|
268 |
|
|
* - Set PSA CRC to make PtP diagnostic tool happy (Bob Gray)
|
269 |
|
|
* - Module init code don't fail if we found at least one card in
|
270 |
|
|
* the address list (Karlis Peisenieks)
|
271 |
|
|
* - Missing parenthesis (Christopher Peterson)
|
272 |
|
|
* - Correct i82586 configuration parameters
|
273 |
|
|
* - Encryption initialisation bug (Robert McCormack)
|
274 |
|
|
* - New mac addresses detected in the probe
|
275 |
|
|
* - Increase watchdog for busy envirnoments
|
276 |
|
|
*
|
277 |
|
|
* Wishes & dreams :
|
278 |
|
|
* ---------------
|
279 |
|
|
* - Roaming
|
280 |
|
|
*/
|
281 |
|
|
|
282 |
|
|
/***************************** INCLUDES *****************************/
|
283 |
|
|
|
284 |
|
|
#include <linux/module.h>
|
285 |
|
|
|
286 |
|
|
#include <linux/kernel.h>
|
287 |
|
|
#include <linux/sched.h>
|
288 |
|
|
#include <linux/types.h>
|
289 |
|
|
#include <linux/fcntl.h>
|
290 |
|
|
#include <linux/interrupt.h>
|
291 |
|
|
#include <linux/stat.h>
|
292 |
|
|
#include <linux/ptrace.h>
|
293 |
|
|
#include <linux/ioport.h>
|
294 |
|
|
#include <linux/in.h>
|
295 |
|
|
#include <linux/string.h>
|
296 |
|
|
#include <linux/delay.h>
|
297 |
|
|
#include <asm/system.h>
|
298 |
|
|
#include <asm/bitops.h>
|
299 |
|
|
#include <asm/io.h>
|
300 |
|
|
#include <asm/dma.h>
|
301 |
|
|
#include <linux/errno.h>
|
302 |
|
|
#include <linux/netdevice.h>
|
303 |
|
|
#include <linux/etherdevice.h>
|
304 |
|
|
#include <linux/skbuff.h>
|
305 |
|
|
#include <linux/malloc.h>
|
306 |
|
|
#include <linux/timer.h>
|
307 |
|
|
|
308 |
|
|
#include <linux/wireless.h> /* Wireless extensions */
|
309 |
|
|
|
310 |
|
|
/* Wavelan declarations */
|
311 |
|
|
#include "i82586.h"
|
312 |
|
|
#include "wavelan.h"
|
313 |
|
|
|
314 |
|
|
/****************************** DEBUG ******************************/
|
315 |
|
|
|
316 |
|
|
#undef DEBUG_MODULE_TRACE /* Module insertion/removal */
|
317 |
|
|
#undef DEBUG_CALLBACK_TRACE /* Calls made by Linux */
|
318 |
|
|
#undef DEBUG_INTERRUPT_TRACE /* Calls to handler */
|
319 |
|
|
#undef DEBUG_INTERRUPT_INFO /* type of interrupt & so on */
|
320 |
|
|
#define DEBUG_INTERRUPT_ERROR /* problems */
|
321 |
|
|
#undef DEBUG_CONFIG_TRACE /* Trace the config functions */
|
322 |
|
|
#undef DEBUG_CONFIG_INFO /* What's going on... */
|
323 |
|
|
#define DEBUG_CONFIG_ERRORS /* Errors on configuration */
|
324 |
|
|
#undef DEBUG_TX_TRACE /* Transmission calls */
|
325 |
|
|
#undef DEBUG_TX_INFO /* Header of the transmited packet */
|
326 |
|
|
#define DEBUG_TX_ERROR /* unexpected conditions */
|
327 |
|
|
#undef DEBUG_RX_TRACE /* Transmission calls */
|
328 |
|
|
#undef DEBUG_RX_INFO /* Header of the transmited packet */
|
329 |
|
|
#define DEBUG_RX_ERROR /* unexpected conditions */
|
330 |
|
|
#undef DEBUG_PACKET_DUMP 16 /* Dump packet on the screen */
|
331 |
|
|
#undef DEBUG_IOCTL_TRACE /* Misc call by Linux */
|
332 |
|
|
#undef DEBUG_IOCTL_INFO /* Various debug info */
|
333 |
|
|
#define DEBUG_IOCTL_ERROR /* What's going wrong */
|
334 |
|
|
#define DEBUG_BASIC_SHOW /* Show basic startup info */
|
335 |
|
|
#undef DEBUG_VERSION_SHOW /* Print version info */
|
336 |
|
|
#undef DEBUG_PSA_SHOW /* Dump psa to screen */
|
337 |
|
|
#undef DEBUG_MMC_SHOW /* Dump mmc to screen */
|
338 |
|
|
#undef DEBUG_SHOW_UNUSED /* Show also unused fields */
|
339 |
|
|
#undef DEBUG_I82586_SHOW /* Show i82586 status */
|
340 |
|
|
#undef DEBUG_DEVICE_SHOW /* Show device parameters */
|
341 |
|
|
|
342 |
|
|
/* Options : */
|
343 |
|
|
#define USE_PSA_CONFIG /* Use info from the PSA */
|
344 |
|
|
#define SET_PSA_CRC /* Calculate and set the CRC on PSA */
|
345 |
|
|
#define IGNORE_NORMAL_XMIT_ERRS /* Don't bother with normal conditions */
|
346 |
|
|
#undef STRUCT_CHECK /* Verify padding of structures */
|
347 |
|
|
#undef OLDIES /* Old code (to redo) */
|
348 |
|
|
#undef RECORD_SNR /* To redo */
|
349 |
|
|
#undef EEPROM_IS_PROTECTED /* Doesn't seem to be necessary */
|
350 |
|
|
#define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical) */
|
351 |
|
|
|
352 |
|
|
#ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */
|
353 |
|
|
/* Warning : these stuff will slow down the driver... */
|
354 |
|
|
#define WIRELESS_SPY /* Enable spying addresses */
|
355 |
|
|
#undef HISTOGRAM /* Enable histogram of sig level... */
|
356 |
|
|
#endif
|
357 |
|
|
|
358 |
|
|
/************************ CONSTANTS & MACROS ************************/
|
359 |
|
|
|
360 |
|
|
#ifdef DEBUG_VERSION_SHOW
|
361 |
|
|
static const char *version = "wavelan.c : v18 (wireless extensions) 18/2/99\n";
|
362 |
|
|
#endif
|
363 |
|
|
|
364 |
|
|
/* Watchdog temporisation */
|
365 |
|
|
#define WATCHDOG_JIFFIES 256 /* TODO: express in HZ. */
|
366 |
|
|
|
367 |
|
|
/* Macro to get the number of elements in an array */
|
368 |
|
|
#define NELS(a) (sizeof(a) / sizeof(a[0]))
|
369 |
|
|
|
370 |
|
|
/* ------------------------ PRIVATE IOCTL ------------------------ */
|
371 |
|
|
|
372 |
|
|
#define SIOCSIPQTHR SIOCDEVPRIVATE /* Set quality threshold */
|
373 |
|
|
#define SIOCGIPQTHR SIOCDEVPRIVATE + 1 /* Get quality threshold */
|
374 |
|
|
#define SIOCSIPLTHR SIOCDEVPRIVATE + 2 /* Set level threshold */
|
375 |
|
|
#define SIOCGIPLTHR SIOCDEVPRIVATE + 3 /* Get level threshold */
|
376 |
|
|
|
377 |
|
|
#define SIOCSIPHISTO SIOCDEVPRIVATE + 6 /* Set histogram ranges */
|
378 |
|
|
#define SIOCGIPHISTO SIOCDEVPRIVATE + 7 /* Get histogram values */
|
379 |
|
|
|
380 |
|
|
/* ----------------------- VERSION SUPPORT ----------------------- */
|
381 |
|
|
|
382 |
|
|
/* This ugly patch is needed to cope with old version of the kernel */
|
383 |
|
|
#ifndef copy_from_user
|
384 |
|
|
#define copy_from_user memcpy_fromfs
|
385 |
|
|
#define copy_to_user memcpy_tofs
|
386 |
|
|
#endif
|
387 |
|
|
|
388 |
|
|
/****************************** TYPES ******************************/
|
389 |
|
|
|
390 |
|
|
/* Shortcuts */
|
391 |
|
|
typedef struct device device;
|
392 |
|
|
typedef struct enet_statistics en_stats;
|
393 |
|
|
typedef struct iw_statistics iw_stats;
|
394 |
|
|
typedef struct iw_quality iw_qual;
|
395 |
|
|
typedef struct iw_freq iw_freq;
|
396 |
|
|
typedef struct net_local net_local;
|
397 |
|
|
typedef struct timer_list timer_list;
|
398 |
|
|
|
399 |
|
|
/* Basic types */
|
400 |
|
|
typedef u_char mac_addr[WAVELAN_ADDR_SIZE]; /* Hardware address */
|
401 |
|
|
|
402 |
|
|
/*
|
403 |
|
|
* Static specific data for the interface.
|
404 |
|
|
*
|
405 |
|
|
* For each network interface, Linux keep data in two structure. "device"
|
406 |
|
|
* keep the generic data (same format for everybody) and "net_local" keep
|
407 |
|
|
* the additional specific data.
|
408 |
|
|
* Note that some of this specific data is in fact generic (en_stats, for
|
409 |
|
|
* example).
|
410 |
|
|
*/
|
411 |
|
|
struct net_local
|
412 |
|
|
{
|
413 |
|
|
net_local * next; /* Linked list of the devices */
|
414 |
|
|
device * dev; /* Reverse link... */
|
415 |
|
|
en_stats stats; /* Ethernet interface statistics */
|
416 |
|
|
int nresets; /* Number of hw resets */
|
417 |
|
|
u_char reconfig_82586; /* Need to reconfigure the controler */
|
418 |
|
|
u_char promiscuous; /* Promiscuous mode */
|
419 |
|
|
int mc_count; /* Number of multicast addresses */
|
420 |
|
|
timer_list watchdog; /* To avoid blocking state */
|
421 |
|
|
u_short hacr; /* Current host interface state */
|
422 |
|
|
|
423 |
|
|
int tx_n_in_use;
|
424 |
|
|
u_short rx_head;
|
425 |
|
|
u_short rx_last;
|
426 |
|
|
u_short tx_first_free;
|
427 |
|
|
u_short tx_first_in_use;
|
428 |
|
|
|
429 |
|
|
#ifdef WIRELESS_EXT
|
430 |
|
|
iw_stats wstats; /* Wireless specific stats */
|
431 |
|
|
#endif
|
432 |
|
|
|
433 |
|
|
#ifdef WIRELESS_SPY
|
434 |
|
|
int spy_number; /* Number of addresses to spy */
|
435 |
|
|
mac_addr spy_address[IW_MAX_SPY]; /* The addresses to spy */
|
436 |
|
|
iw_qual spy_stat[IW_MAX_SPY]; /* Statistics gathered */
|
437 |
|
|
#endif /* WIRELESS_SPY */
|
438 |
|
|
#ifdef HISTOGRAM
|
439 |
|
|
int his_number; /* Number of intervals */
|
440 |
|
|
u_char his_range[16]; /* Boundaries of interval ]n-1; n] */
|
441 |
|
|
u_long his_sum[16]; /* Sum in interval */
|
442 |
|
|
#endif /* HISTOGRAM */
|
443 |
|
|
};
|
444 |
|
|
|
445 |
|
|
/**************************** PROTOTYPES ****************************/
|
446 |
|
|
|
447 |
|
|
/* ----------------------- MISC SUBROUTINES ------------------------ */
|
448 |
|
|
static inline unsigned long /* flags */
|
449 |
|
|
wv_splhi(void); /* Disable interrupts */
|
450 |
|
|
static inline void
|
451 |
|
|
wv_splx(unsigned long); /* ReEnable interrupts : flags */
|
452 |
|
|
static u_char
|
453 |
|
|
wv_irq_to_psa(int);
|
454 |
|
|
static int
|
455 |
|
|
wv_psa_to_irq(u_char);
|
456 |
|
|
/* ------------------- HOST ADAPTER SUBROUTINES ------------------- */
|
457 |
|
|
static inline u_short /* data */
|
458 |
|
|
hasr_read(u_long); /* Read the host interface : base address */
|
459 |
|
|
static inline void
|
460 |
|
|
hacr_write(u_long, /* Write to host interface : base address */
|
461 |
|
|
u_short), /* data */
|
462 |
|
|
hacr_write_slow(u_long,
|
463 |
|
|
u_short),
|
464 |
|
|
set_chan_attn(u_long, /* ioaddr */
|
465 |
|
|
u_short), /* hacr */
|
466 |
|
|
wv_hacr_reset(u_long), /* ioaddr */
|
467 |
|
|
wv_16_off(u_long, /* ioaddr */
|
468 |
|
|
u_short), /* hacr */
|
469 |
|
|
wv_16_on(u_long, /* ioaddr */
|
470 |
|
|
u_short), /* hacr */
|
471 |
|
|
wv_ints_off(device *),
|
472 |
|
|
wv_ints_on(device *);
|
473 |
|
|
/* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */
|
474 |
|
|
static void
|
475 |
|
|
psa_read(u_long, /* Read the Parameter Storage Area */
|
476 |
|
|
u_short, /* hacr */
|
477 |
|
|
int, /* offset in PSA */
|
478 |
|
|
u_char *, /* buffer to fill */
|
479 |
|
|
int), /* size to read */
|
480 |
|
|
psa_write(u_long, /* Write to the PSA */
|
481 |
|
|
u_short, /* hacr */
|
482 |
|
|
int, /* Offset in psa */
|
483 |
|
|
u_char *, /* Buffer in memory */
|
484 |
|
|
int); /* Length of buffer */
|
485 |
|
|
static inline void
|
486 |
|
|
mmc_out(u_long, /* Write 1 byte to the Modem Manag Control */
|
487 |
|
|
u_short,
|
488 |
|
|
u_char),
|
489 |
|
|
mmc_write(u_long, /* Write n bytes to the MMC */
|
490 |
|
|
u_char,
|
491 |
|
|
u_char *,
|
492 |
|
|
int);
|
493 |
|
|
static inline u_char /* Read 1 byte from the MMC */
|
494 |
|
|
mmc_in(u_long,
|
495 |
|
|
u_short);
|
496 |
|
|
static inline void
|
497 |
|
|
mmc_read(u_long, /* Read n bytes from the MMC */
|
498 |
|
|
u_char,
|
499 |
|
|
u_char *,
|
500 |
|
|
int),
|
501 |
|
|
fee_wait(u_long, /* Wait for frequency EEprom : base address */
|
502 |
|
|
int, /* Base delay to wait for */
|
503 |
|
|
int); /* Number of time to wait */
|
504 |
|
|
static void
|
505 |
|
|
fee_read(u_long, /* Read the frequency EEprom : base address */
|
506 |
|
|
u_short, /* destination offset */
|
507 |
|
|
u_short *, /* data buffer */
|
508 |
|
|
int); /* number of registers */
|
509 |
|
|
/* ---------------------- I82586 SUBROUTINES ----------------------- */
|
510 |
|
|
static /*inline*/ void
|
511 |
|
|
obram_read(u_long, /* ioaddr */
|
512 |
|
|
u_short, /* o */
|
513 |
|
|
u_char *, /* b */
|
514 |
|
|
int); /* n */
|
515 |
|
|
static inline void
|
516 |
|
|
obram_write(u_long, /* ioaddr */
|
517 |
|
|
u_short, /* o */
|
518 |
|
|
u_char *, /* b */
|
519 |
|
|
int); /* n */
|
520 |
|
|
static void
|
521 |
|
|
wv_ack(device *);
|
522 |
|
|
static inline int
|
523 |
|
|
wv_synchronous_cmd(device *,
|
524 |
|
|
const char *),
|
525 |
|
|
wv_config_complete(device *,
|
526 |
|
|
u_long,
|
527 |
|
|
net_local *);
|
528 |
|
|
static int
|
529 |
|
|
wv_complete(device *,
|
530 |
|
|
u_long,
|
531 |
|
|
net_local *);
|
532 |
|
|
static inline void
|
533 |
|
|
wv_82586_reconfig(device *);
|
534 |
|
|
/* ------------------- DEBUG & INFO SUBROUTINES ------------------- */
|
535 |
|
|
#ifdef DEBUG_I82586_SHOW
|
536 |
|
|
static void
|
537 |
|
|
wv_scb_show(unsigned short);
|
538 |
|
|
#endif
|
539 |
|
|
static inline void
|
540 |
|
|
wv_init_info(device *); /* display startup info */
|
541 |
|
|
/* ------------------- IOCTL, STATS & RECONFIG ------------------- */
|
542 |
|
|
static en_stats *
|
543 |
|
|
wavelan_get_stats(device *); /* Give stats /proc/net/dev */
|
544 |
|
|
static void
|
545 |
|
|
wavelan_set_multicast_list(device *);
|
546 |
|
|
/* ----------------------- PACKET RECEPTION ----------------------- */
|
547 |
|
|
static inline void
|
548 |
|
|
wv_packet_read(device *, /* Read a packet from a frame */
|
549 |
|
|
u_short,
|
550 |
|
|
int),
|
551 |
|
|
wv_receive(device *); /* Read all packets waiting */
|
552 |
|
|
/* --------------------- PACKET TRANSMISSION --------------------- */
|
553 |
|
|
static inline void
|
554 |
|
|
wv_packet_write(device *, /* Write a packet to the Tx buffer */
|
555 |
|
|
void *,
|
556 |
|
|
short);
|
557 |
|
|
static int
|
558 |
|
|
wavelan_packet_xmit(struct sk_buff *, /* Send a packet */
|
559 |
|
|
device *);
|
560 |
|
|
/* -------------------- HARDWARE CONFIGURATION -------------------- */
|
561 |
|
|
static inline int
|
562 |
|
|
wv_mmc_init(device *), /* Initialize the modem */
|
563 |
|
|
wv_ru_start(device *), /* Start the i82586 receiver unit */
|
564 |
|
|
wv_cu_start(device *), /* Start the i82586 command unit */
|
565 |
|
|
wv_82586_start(device *); /* Start the i82586 */
|
566 |
|
|
static void
|
567 |
|
|
wv_82586_config(device *); /* Configure the i82586 */
|
568 |
|
|
static inline void
|
569 |
|
|
wv_82586_stop(device *);
|
570 |
|
|
static int
|
571 |
|
|
wv_hw_reset(device *), /* Reset the wavelan hardware */
|
572 |
|
|
wv_check_ioaddr(u_long, /* ioaddr */
|
573 |
|
|
u_char *); /* mac address (read) */
|
574 |
|
|
/* ---------------------- INTERRUPT HANDLING ---------------------- */
|
575 |
|
|
static void
|
576 |
|
|
wavelan_interrupt(int, /* Interrupt handler */
|
577 |
|
|
void *,
|
578 |
|
|
struct pt_regs *);
|
579 |
|
|
static void
|
580 |
|
|
wavelan_watchdog(u_long); /* Transmission watchdog */
|
581 |
|
|
/* ------------------- CONFIGURATION CALLBACKS ------------------- */
|
582 |
|
|
static int
|
583 |
|
|
wavelan_open(device *), /* Open the device */
|
584 |
|
|
wavelan_close(device *), /* Close the device */
|
585 |
|
|
wavelan_config(device *); /* Configure one device */
|
586 |
|
|
extern int
|
587 |
|
|
wavelan_probe(device *); /* See Space.c */
|
588 |
|
|
|
589 |
|
|
/**************************** VARIABLES ****************************/
|
590 |
|
|
|
591 |
|
|
/*
|
592 |
|
|
* This is the root of the linked list of wavelan drivers
|
593 |
|
|
* It is use to verify that we don't reuse the same base address
|
594 |
|
|
* for two differents drivers and to make the cleanup when
|
595 |
|
|
* removing the module.
|
596 |
|
|
*/
|
597 |
|
|
static net_local * wavelan_list = (net_local *) NULL;
|
598 |
|
|
|
599 |
|
|
/*
|
600 |
|
|
* This table is used to translate the psa value to irq number
|
601 |
|
|
* and vice versa...
|
602 |
|
|
*/
|
603 |
|
|
static u_char irqvals[] =
|
604 |
|
|
{
|
605 |
|
|
0, 0, 0, 0x01,
|
606 |
|
|
0x02, 0x04, 0, 0x08,
|
607 |
|
|
0, 0, 0x10, 0x20,
|
608 |
|
|
0x40, 0, 0, 0x80,
|
609 |
|
|
};
|
610 |
|
|
|
611 |
|
|
/*
|
612 |
|
|
* Table of the available i/o address (base address) for wavelan
|
613 |
|
|
*/
|
614 |
|
|
static unsigned short iobase[] =
|
615 |
|
|
{
|
616 |
|
|
#if 0
|
617 |
|
|
/* Leave out 0x3C0 for now -- seems to clash with some video
|
618 |
|
|
* controllers.
|
619 |
|
|
* Leave out the others too -- we will always use 0x390 and leave
|
620 |
|
|
* 0x300 for the Ethernet device.
|
621 |
|
|
* Jean II : 0x3E0 is really fine as well...
|
622 |
|
|
*/
|
623 |
|
|
0x300, 0x390, 0x3E0, 0x3C0
|
624 |
|
|
#endif /* 0 */
|
625 |
|
|
0x390, 0x3E0
|
626 |
|
|
};
|
627 |
|
|
|
628 |
|
|
#ifdef MODULE
|
629 |
|
|
/* Name of the devices (memory allocation) */
|
630 |
|
|
static char devname[4][IFNAMSIZ] = { "", "", "", "" };
|
631 |
|
|
|
632 |
|
|
/* Parameters set by insmod */
|
633 |
|
|
static int io[4] = { 0, 0, 0, 0 };
|
634 |
|
|
static int irq[4] = { 0, 0, 0, 0 };
|
635 |
|
|
static char * name[4] = { devname[0], devname[1], devname[2], devname[3] };
|
636 |
|
|
#endif /* MODULE */
|
637 |
|
|
|
638 |
|
|
#endif /* WAVELAN_P_H */
|