blob: 166e28b9a4f7fca1464b5b500cd1759a0b2a6e34 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * WaveLAN ISA driver
3 *
4 * Jean II - HPLB '96
5 *
6 * Reorganisation and extension of the driver.
7 *
8 * This file contains all definitions and declarations necessary for the
9 * WaveLAN ISA driver. This file is a private header, so it should
10 * be included only in wavelan.c!
11 */
12
13#ifndef WAVELAN_P_H
14#define WAVELAN_P_H
15
16/************************** DOCUMENTATION ***************************/
17/*
18 * This driver provides 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 * WaveLANs are also distributed by DEC (RoamAbout DS) and Digital Ocean.
22 *
23 * To learn how to use this driver, read the NET3 HOWTO.
24 * If you want to exploit the many other functionalities, read the comments
25 * in the code.
26 *
27 * This driver is the result of the effort of many people (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.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wavelan.html
36 *
37 * SMP
38 * ---
39 * We now are SMP compliant (I eventually fixed the remaining bugs).
40 * The driver has been tested on a dual P6-150 and survived my usual
41 * set of torture tests.
42 * Anyway, I spent enough time chasing interrupt re-entrancy during
43 * errors or reconfigure, and I designed the locked/unlocked sections
44 * of the driver with great care, and with the recent addition of
45 * the spinlock (thanks to the new API), we should be quite close to
46 * the truth.
47 * The SMP/IRQ locking is quite coarse and conservative (i.e. not fast),
48 * but better safe than sorry (especially at 2 Mb/s ;-).
49 *
50 * I have also looked into disabling only our interrupt on the card
51 * (via HACR) instead of all interrupts in the processor (via cli),
52 * so that other driver are not impacted, and it look like it's
53 * possible, but it's very tricky to do right (full of races). As
54 * the gain would be mostly for SMP systems, it can wait...
55 *
56 * Debugging and options
57 * ---------------------
58 * You will find below a set of '#define" allowing a very fine control
59 * on the driver behaviour and the debug messages printed.
60 * The main options are :
61 * o SET_PSA_CRC, to have your card correctly recognised by
62 * an access point and the Point-to-Point diagnostic tool.
63 * o USE_PSA_CONFIG, to read configuration from the PSA (EEprom)
64 * (otherwise we always start afresh with some defaults)
65 *
66 * wavelan.o is too darned big
67 * ---------------------------
68 * That's true! There is a very simple way to reduce the driver
69 * object by 33%! Comment out the following line:
70 * #include <linux/wireless.h>
71 * Other compile options can also reduce the size of it...
72 *
73 * MAC address and hardware detection:
74 * -----------------------------------
75 * The detection code for the WaveLAN checks that the first three
76 * octets of the MAC address fit the company code. This type of
77 * detection works well for AT&T cards (because the AT&T code is
78 * hardcoded in wavelan.h), but of course will fail for other
79 * manufacturers.
80 *
81 * If you are sure that your card is derived from the WaveLAN,
82 * here is the way to configure it:
83 * 1) Get your MAC address
84 * a) With your card utilities (wfreqsel, instconf, etc.)
85 * b) With the driver:
86 * o compile the kernel with DEBUG_CONFIG_INFO enabled
87 * o Boot and look the card messages
88 * 2) Set your MAC code (3 octets) in MAC_ADDRESSES[][3] (wavelan.h)
89 * 3) Compile and verify
90 * 4) Send me the MAC code. I will include it in the next version.
91 *
92 */
93
94/* --------------------- WIRELESS EXTENSIONS --------------------- */
95/*
96 * This driver is the first to support "wireless extensions".
97 * This set of extensions provides a standard way to control the wireless
98 * characteristics of the hardware. Applications such as mobile IP may
99 * take advantage of it.
100 *
101 * You will need to enable the CONFIG_NET_RADIO define in the kernel
102 * configuration to enable the wireless extensions (this is the one
103 * giving access to the radio network device choice).
104 *
105 * It might also be a good idea as well to fetch the wireless tools to
106 * configure the device and play a bit.
107 */
108
109/* ---------------------------- FILES ---------------------------- */
110/*
111 * wavelan.c: actual code for the driver: C functions
112 *
113 * wavelan.p.h: private header: local types and variables for driver
114 *
115 * wavelan.h: description of the hardware interface and structs
116 *
117 * i82586.h: description of the Ethernet controller
118 */
119
120/* --------------------------- HISTORY --------------------------- */
121/*
122 * This is based on information in the drivers' headers. It may not be
123 * accurate, and I guarantee only my best effort.
124 *
125 * The history of the WaveLAN drivers is as complicated as the history of
126 * the WaveLAN itself (NCR -> AT&T -> Lucent).
127 *
128 * It all started with Anders Klemets <klemets@paul.rutgers.edu>
129 * writing a WaveLAN ISA driver for the Mach microkernel. Girish
130 * Welling <welling@paul.rutgers.edu> had also worked on it.
131 * Keith Moore modified this for the PCMCIA hardware.
132 *
133 * Robert Morris <rtm@das.harvard.edu> ported these two drivers to BSDI
134 * and added specific PCMCIA support (there is currently no equivalent
135 * of the PCMCIA package under BSD).
136 *
137 * Jim Binkley <jrb@cs.pdx.edu> ported both BSDI drivers to FreeBSD.
138 *
139 * Bruce Janson <bruce@cs.usyd.edu.au> ported the BSDI ISA driver to Linux.
140 *
141 * Anthony D. Joseph <adj@lcs.mit.edu> started to modify Bruce's driver
142 * (with help of the BSDI PCMCIA driver) for PCMCIA.
143 * Yunzhou Li <yunzhou@strat.iol.unh.edu> finished this work.
144 * Joe Finney <joe@comp.lancs.ac.uk> patched the driver to start
145 * 2.00 cards correctly (2.4 GHz with frequency selection).
146 * David Hinds <dahinds@users.sourceforge.net> integrated the whole in his
147 * PCMCIA package (and bug corrections).
148 *
149 * I (Jean Tourrilhes - jt@hplb.hpl.hp.com) then started to make some
150 * patches to the PCMCIA driver. Later, I added code in the ISA driver
151 * for Wireless Extensions and full support of frequency selection
152 * cards. Then, I did the same to the PCMCIA driver, and did some
153 * reorganisation. Finally, I came back to the ISA driver to
154 * upgrade it at the same level as the PCMCIA one and reorganise
155 * the code.
156 * Loeke Brederveld <lbrederv@wavelan.com> from Lucent has given me
157 * much needed information on the WaveLAN hardware.
158 */
159
160/* The original copyrights and literature mention others' names and
161 * credits. I don't know what their part in this development was.
162 */
163
164/* By the way, for the copyright and legal stuff:
165 * almost everybody wrote code under the GNU or BSD license (or similar),
166 * and want their original copyright to remain somewhere in the
167 * code (for myself, I go with the GPL).
168 * Nobody wants to take responsibility for anything, except the fame.
169 */
170
171/* --------------------------- CREDITS --------------------------- */
172/*
173 * This software was developed as a component of the
174 * Linux operating system.
175 * It is based on other device drivers and information
176 * either written or supplied by:
177 * Ajay Bakre <bakre@paul.rutgers.edu>,
178 * Donald Becker <becker@cesdis.gsfc.nasa.gov>,
179 * Loeke Brederveld <Loeke.Brederveld@Utrecht.NCR.com>,
180 * Brent Elphick <belphick@uwaterloo.ca>,
181 * Anders Klemets <klemets@it.kth.se>,
182 * Vladimir V. Kolpakov <w@stier.koenig.ru>,
183 * Marc Meertens <Marc.Meertens@Utrecht.NCR.com>,
184 * Pauline Middelink <middelin@polyware.iaf.nl>,
185 * Robert Morris <rtm@das.harvard.edu>,
186 * Jean Tourrilhes <jt@hpl.hp.com>,
187 * Girish Welling <welling@paul.rutgers.edu>,
188 * Clark Woodworth <clark@hiway1.exit109.com>
189 * Yongguang Zhang <ygz@isl.hrl.hac.com>
190 *
191 * Thanks go also to:
192 * James Ashton <jaa101@syseng.anu.edu.au>,
193 * Alan Cox <alan@redhat.com>,
194 * Allan Creighton <allanc@cs.usyd.edu.au>,
195 * Matthew Geier <matthew@cs.usyd.edu.au>,
196 * Remo di Giovanni <remo@cs.usyd.edu.au>,
197 * Eckhard Grah <grah@wrcs1.urz.uni-wuppertal.de>,
198 * Vipul Gupta <vgupta@cs.binghamton.edu>,
199 * Mark Hagan <mhagan@wtcpost.daytonoh.NCR.COM>,
200 * Tim Nicholson <tim@cs.usyd.edu.au>,
201 * Ian Parkin <ian@cs.usyd.edu.au>,
202 * John Rosenberg <johnr@cs.usyd.edu.au>,
203 * George Rossi <george@phm.gov.au>,
204 * Arthur Scott <arthur@cs.usyd.edu.au>,
205 * Stanislav Sinyagin <stas@isf.ru>
206 * and Peter Storey for their assistance and advice.
207 *
208 * Additional Credits:
209 *
210 * My development has been done initially under Debian 1.1 (Linux 2.0.x)
211 * and now under Debian 2.2, initially with an HP Vectra XP/60, and now
212 * an HP Vectra XP/90.
213 *
214 */
215
216/* ------------------------- IMPROVEMENTS ------------------------- */
217/*
218 * I proudly present:
219 *
220 * Changes made in first pre-release:
221 * ----------------------------------
222 * - reorganisation of the code, function name change
223 * - creation of private header (wavelan.p.h)
224 * - reorganised debug messages
225 * - more comments, history, etc.
226 * - mmc_init: configure the PSA if not done
227 * - mmc_init: correct default value of level threshold for PCMCIA
228 * - mmc_init: 2.00 detection better code for 2.00 initialization
229 * - better info at startup
230 * - IRQ setting (note: this setting is permanent)
231 * - watchdog: change strategy (and solve module removal problems)
232 * - add wireless extensions (ioctl and get_wireless_stats)
233 * get/set nwid/frequency on fly, info for /proc/net/wireless
234 * - more wireless extensions: SETSPY and GETSPY
235 * - make wireless extensions optional
236 * - private ioctl to set/get quality and level threshold, histogram
237 * - remove /proc/net/wavelan
238 * - suppress useless stuff from lp (net_local)
239 * - kernel 2.1 support (copy_to/from_user instead of memcpy_to/fromfs)
240 * - add message level (debug stuff in /var/adm/debug and errors not
241 * displayed at console and still in /var/adm/messages)
242 * - multi device support
243 * - start fixing the probe (init code)
244 * - more inlines
245 * - man page
246 * - many other minor details and cleanups
247 *
248 * Changes made in second pre-release:
249 * -----------------------------------
250 * - clean up init code (probe and module init)
251 * - better multiple device support (module)
252 * - name assignment (module)
253 *
254 * Changes made in third pre-release:
255 * ----------------------------------
256 * - be more conservative on timers
257 * - preliminary support for multicast (I still lack some details)
258 *
259 * Changes made in fourth pre-release:
260 * -----------------------------------
261 * - multicast (revisited and finished)
262 * - avoid reset in set_multicast_list (a really big hack)
263 * if somebody could apply this code for other i82586 based drivers
264 * - share onboard memory 75% RU and 25% CU (instead of 50/50)
265 *
266 * Changes made for release in 2.1.15:
267 * -----------------------------------
268 * - change the detection code for multi manufacturer code support
269 *
270 * Changes made for release in 2.1.17:
271 * -----------------------------------
272 * - update to wireless extensions changes
273 * - silly bug in card initial configuration (psa_conf_status)
274 *
275 * Changes made for release in 2.1.27 & 2.0.30:
276 * --------------------------------------------
277 * - small bug in debug code (probably not the last one...)
278 * - remove extern keyword for wavelan_probe()
279 * - level threshold is now a standard wireless extension (version 4 !)
280 * - modules parameters types (new module interface)
281 *
282 * Changes made for release in 2.1.36:
283 * -----------------------------------
284 * - byte count stats (courtesy of David Hinds)
285 * - remove dev_tint stuff (courtesy of David Hinds)
286 * - encryption setting from Brent Elphick (thanks a lot!)
287 * - 'ioaddr' to 'u_long' for the Alpha (thanks to Stanislav Sinyagin)
288 *
289 * Other changes (not by me) :
290 * -------------------------
291 * - Spelling and gramar "rectification".
292 *
293 * Changes made for release in 2.0.37 & 2.2.2 :
294 * ------------------------------------------
295 * - Correct status in /proc/net/wireless
296 * - Set PSA CRC to make PtP diagnostic tool happy (Bob Gray)
297 * - Module init code don't fail if we found at least one card in
298 * the address list (Karlis Peisenieks)
299 * - Missing parenthesis (Christopher Peterson)
300 * - Correct i82586 configuration parameters
301 * - Encryption initialisation bug (Robert McCormack)
302 * - New mac addresses detected in the probe
303 * - Increase watchdog for busy environments
304 *
305 * Changes made for release in 2.0.38 & 2.2.7 :
306 * ------------------------------------------
307 * - Correct the reception logic to better report errors and avoid
308 * sending bogus packet up the stack
309 * - Delay RU config to avoid corrupting first received packet
310 * - Change config completion code (to actually check something)
311 * - Avoid reading out of bound in skbuf to transmit
312 * - Rectify a lot of (useless) debugging code
313 * - Change the way to `#ifdef SET_PSA_CRC'
314 *
315 * Changes made for release in 2.2.11 & 2.3.13 :
316 * -------------------------------------------
317 * - Change e-mail and web page addresses
318 * - Watchdog timer is now correctly expressed in HZ, not in jiffies
319 * - Add channel number to the list of frequencies in range
320 * - Add the (short) list of bit-rates in range
321 * - Developp a new sensitivity... (sens.value & sens.fixed)
322 *
323 * Changes made for release in 2.2.14 & 2.3.23 :
324 * -------------------------------------------
325 * - Fix check for root permission (break instead of exit)
326 * - New nwid & encoding setting (Wireless Extension 9)
327 *
328 * Changes made for release in 2.3.49 :
329 * ----------------------------------
330 * - Indentation reformating (Alan)
331 * - Update to new network API (softnet - 2.3.43) :
332 * o replace dev->tbusy (Alan)
333 * o replace dev->tstart (Alan)
334 * o remove dev->interrupt (Alan)
335 * o add SMP locking via spinlock in splxx (me)
336 * o add spinlock in interrupt handler (me)
337 * o use kernel watchdog instead of ours (me)
338 * o increase watchdog timeout (kernel is more sensitive) (me)
339 * o verify that all the changes make sense and work (me)
340 * - Fixup a potential gotcha when reconfiguring and thighten a bit
341 * the interactions with Tx queue.
342 *
343 * Changes made for release in 2.4.0 :
344 * ---------------------------------
345 * - Fix spinlock stupid bugs that I left in. The driver is now SMP
346 * compliant and doesn't lockup at startup.
347 *
348 * Changes made for release in 2.5.2 :
349 * ---------------------------------
350 * - Use new driver API for Wireless Extensions :
351 * o got rid of wavelan_ioctl()
352 * o use a bunch of iw_handler instead
353 *
354 * Changes made for release in 2.5.35 :
355 * ----------------------------------
356 * - Set dev->trans_start to avoid filling the logs
357 * - Handle better spurious/bogus interrupt
358 * - Avoid deadlocks in mmc_out()/mmc_in()
359 *
360 * Wishes & dreams:
361 * ----------------
362 * - roaming (see Pcmcia driver)
363 */
364
365/***************************** INCLUDES *****************************/
366
367#include <linux/module.h>
368
369#include <linux/kernel.h>
370#include <linux/sched.h>
371#include <linux/types.h>
372#include <linux/fcntl.h>
373#include <linux/interrupt.h>
374#include <linux/stat.h>
375#include <linux/ptrace.h>
376#include <linux/ioport.h>
377#include <linux/in.h>
378#include <linux/string.h>
379#include <linux/delay.h>
380#include <linux/bitops.h>
381#include <asm/system.h>
382#include <asm/io.h>
383#include <asm/dma.h>
384#include <asm/uaccess.h>
385#include <linux/errno.h>
386#include <linux/netdevice.h>
387#include <linux/etherdevice.h>
388#include <linux/skbuff.h>
389#include <linux/slab.h>
390#include <linux/timer.h>
391#include <linux/init.h>
392
393#include <linux/wireless.h> /* Wireless extensions */
394#include <net/iw_handler.h> /* Wireless handlers */
395
396/* WaveLAN declarations */
397#include "i82586.h"
398#include "wavelan.h"
399
400/************************** DRIVER OPTIONS **************************/
401/*
402 * `#define' or `#undef' the following constant to change the behaviour
403 * of the driver...
404 */
405#undef SET_PSA_CRC /* Calculate and set the CRC on PSA (slower) */
406#define USE_PSA_CONFIG /* Use info from the PSA. */
407#undef STRUCT_CHECK /* Verify padding of structures. */
408#undef EEPROM_IS_PROTECTED /* doesn't seem to be necessary */
409#define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical). */
410#undef SET_MAC_ADDRESS /* Experimental */
411
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412/* Warning: this stuff will slow down the driver. */
413#define WIRELESS_SPY /* Enable spying addresses. */
414#undef HISTOGRAM /* Enable histogram of signal level. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415
416/****************************** DEBUG ******************************/
417
418#undef DEBUG_MODULE_TRACE /* module insertion/removal */
419#undef DEBUG_CALLBACK_TRACE /* calls made by Linux */
420#undef DEBUG_INTERRUPT_TRACE /* calls to handler */
421#undef DEBUG_INTERRUPT_INFO /* type of interrupt and so on */
422#define DEBUG_INTERRUPT_ERROR /* problems */
423#undef DEBUG_CONFIG_TRACE /* Trace the config functions. */
424#undef DEBUG_CONFIG_INFO /* what's going on */
425#define DEBUG_CONFIG_ERROR /* errors on configuration */
426#undef DEBUG_TX_TRACE /* transmission calls */
427#undef DEBUG_TX_INFO /* header of the transmitted packet */
428#undef DEBUG_TX_FAIL /* Normal failure conditions */
429#define DEBUG_TX_ERROR /* Unexpected conditions */
430#undef DEBUG_RX_TRACE /* transmission calls */
431#undef DEBUG_RX_INFO /* header of the received packet */
432#undef DEBUG_RX_FAIL /* Normal failure conditions */
433#define DEBUG_RX_ERROR /* Unexpected conditions */
434
435#undef DEBUG_PACKET_DUMP /* Dump packet on the screen if defined to 32. */
436#undef DEBUG_IOCTL_TRACE /* misc. call by Linux */
437#undef DEBUG_IOCTL_INFO /* various debugging info */
438#define DEBUG_IOCTL_ERROR /* what's going wrong */
439#define DEBUG_BASIC_SHOW /* Show basic startup info. */
440#undef DEBUG_VERSION_SHOW /* Print version info. */
441#undef DEBUG_PSA_SHOW /* Dump PSA to screen. */
442#undef DEBUG_MMC_SHOW /* Dump mmc to screen. */
443#undef DEBUG_SHOW_UNUSED /* Show unused fields too. */
444#undef DEBUG_I82586_SHOW /* Show i82586 status. */
445#undef DEBUG_DEVICE_SHOW /* Show device parameters. */
446
447/************************ CONSTANTS & MACROS ************************/
448
449#ifdef DEBUG_VERSION_SHOW
450static const char *version = "wavelan.c : v24 (SMP + wireless extensions) 11/12/01\n";
451#endif
452
453/* Watchdog temporisation */
454#define WATCHDOG_JIFFIES (512*HZ/100)
455
456/* Macro to get the number of elements in an array */
457#define NELS(a) (sizeof(a) / sizeof(a[0]))
458
459/* ------------------------ PRIVATE IOCTL ------------------------ */
460
461#define SIOCSIPQTHR SIOCIWFIRSTPRIV /* Set quality threshold */
462#define SIOCGIPQTHR SIOCIWFIRSTPRIV + 1 /* Get quality threshold */
463
464#define SIOCSIPHISTO SIOCIWFIRSTPRIV + 2 /* Set histogram ranges */
465#define SIOCGIPHISTO SIOCIWFIRSTPRIV + 3 /* Get histogram values */
466
467/****************************** TYPES ******************************/
468
469/* Shortcuts */
470typedef struct net_device_stats en_stats;
471typedef struct iw_statistics iw_stats;
472typedef struct iw_quality iw_qual;
473typedef struct iw_freq iw_freq;
474typedef struct net_local net_local;
475typedef struct timer_list timer_list;
476
477/* Basic types */
478typedef u_char mac_addr[WAVELAN_ADDR_SIZE]; /* Hardware address */
479
480/*
481 * Static specific data for the interface.
482 *
483 * For each network interface, Linux keeps data in two structures: "device"
484 * keeps the generic data (same format for everybody) and "net_local" keeps
485 * additional specific data.
486 * Note that some of this specific data is in fact generic (en_stats, for
487 * example).
488 */
489struct net_local
490{
491 net_local * next; /* linked list of the devices */
492 struct net_device * dev; /* reverse link */
493 spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
494 en_stats stats; /* Ethernet interface statistics */
495 int nresets; /* number of hardware resets */
496 u_char reconfig_82586; /* We need to reconfigure the controller. */
497 u_char promiscuous; /* promiscuous mode */
498 int mc_count; /* number of multicast addresses */
499 u_short hacr; /* current host interface state */
500
501 int tx_n_in_use;
502 u_short rx_head;
503 u_short rx_last;
504 u_short tx_first_free;
505 u_short tx_first_in_use;
506
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 iw_stats wstats; /* Wireless-specific statistics */
508
509 struct iw_spy_data spy_data;
510 struct iw_public_data wireless_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511
512#ifdef HISTOGRAM
513 int his_number; /* number of intervals */
514 u_char his_range[16]; /* boundaries of interval ]n-1; n] */
515 u_long his_sum[16]; /* sum in interval */
516#endif /* HISTOGRAM */
517};
518
519/**************************** PROTOTYPES ****************************/
520
521/* ----------------------- MISC. SUBROUTINES ------------------------ */
522static u_char
523 wv_irq_to_psa(int);
524static int
525 wv_psa_to_irq(u_char);
526/* ------------------- HOST ADAPTER SUBROUTINES ------------------- */
527static inline u_short /* data */
528 hasr_read(u_long); /* Read the host interface: base address */
529static inline void
530 hacr_write(u_long, /* Write to host interface: base address */
531 u_short), /* data */
532 hacr_write_slow(u_long,
533 u_short),
534 set_chan_attn(u_long, /* ioaddr */
535 u_short), /* hacr */
536 wv_hacr_reset(u_long), /* ioaddr */
537 wv_16_off(u_long, /* ioaddr */
538 u_short), /* hacr */
539 wv_16_on(u_long, /* ioaddr */
540 u_short), /* hacr */
541 wv_ints_off(struct net_device *),
542 wv_ints_on(struct net_device *);
543/* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */
544static void
545 psa_read(u_long, /* Read the Parameter Storage Area. */
546 u_short, /* hacr */
547 int, /* offset in PSA */
548 u_char *, /* buffer to fill */
549 int), /* size to read */
550 psa_write(u_long, /* Write to the PSA. */
551 u_short, /* hacr */
552 int, /* offset in PSA */
553 u_char *, /* buffer in memory */
554 int); /* length of buffer */
555static inline void
556 mmc_out(u_long, /* Write 1 byte to the Modem Manag Control. */
557 u_short,
558 u_char),
559 mmc_write(u_long, /* Write n bytes to the MMC. */
560 u_char,
561 u_char *,
562 int);
563static inline u_char /* Read 1 byte from the MMC. */
564 mmc_in(u_long,
565 u_short);
566static inline void
567 mmc_read(u_long, /* Read n bytes from the MMC. */
568 u_char,
569 u_char *,
570 int),
571 fee_wait(u_long, /* Wait for frequency EEPROM: base address */
572 int, /* base delay to wait for */
573 int); /* time to wait */
574static void
575 fee_read(u_long, /* Read the frequency EEPROM: base address */
576 u_short, /* destination offset */
577 u_short *, /* data buffer */
578 int); /* number of registers */
579/* ---------------------- I82586 SUBROUTINES ----------------------- */
580static /*inline*/ void
581 obram_read(u_long, /* ioaddr */
582 u_short, /* o */
583 u_char *, /* b */
584 int); /* n */
585static inline void
586 obram_write(u_long, /* ioaddr */
587 u_short, /* o */
588 u_char *, /* b */
589 int); /* n */
590static void
591 wv_ack(struct net_device *);
592static inline int
593 wv_synchronous_cmd(struct net_device *,
594 const char *),
595 wv_config_complete(struct net_device *,
596 u_long,
597 net_local *);
598static int
599 wv_complete(struct net_device *,
600 u_long,
601 net_local *);
602static inline void
603 wv_82586_reconfig(struct net_device *);
604/* ------------------- DEBUG & INFO SUBROUTINES ------------------- */
605#ifdef DEBUG_I82586_SHOW
606static void
607 wv_scb_show(unsigned short);
608#endif
609static inline void
610 wv_init_info(struct net_device *); /* display startup info */
611/* ------------------- IOCTL, STATS & RECONFIG ------------------- */
612static en_stats *
613 wavelan_get_stats(struct net_device *); /* Give stats /proc/net/dev */
614static iw_stats *
615 wavelan_get_wireless_stats(struct net_device *);
616static void
617 wavelan_set_multicast_list(struct net_device *);
618/* ----------------------- PACKET RECEPTION ----------------------- */
619static inline void
620 wv_packet_read(struct net_device *, /* Read a packet from a frame. */
621 u_short,
622 int),
623 wv_receive(struct net_device *); /* Read all packets waiting. */
624/* --------------------- PACKET TRANSMISSION --------------------- */
625static inline int
626 wv_packet_write(struct net_device *, /* Write a packet to the Tx buffer. */
627 void *,
628 short);
629static int
630 wavelan_packet_xmit(struct sk_buff *, /* Send a packet. */
631 struct net_device *);
632/* -------------------- HARDWARE CONFIGURATION -------------------- */
633static inline int
634 wv_mmc_init(struct net_device *), /* Initialize the modem. */
635 wv_ru_start(struct net_device *), /* Start the i82586 receiver unit. */
636 wv_cu_start(struct net_device *), /* Start the i82586 command unit. */
637 wv_82586_start(struct net_device *); /* Start the i82586. */
638static void
639 wv_82586_config(struct net_device *); /* Configure the i82586. */
640static inline void
641 wv_82586_stop(struct net_device *);
642static int
643 wv_hw_reset(struct net_device *), /* Reset the WaveLAN hardware. */
644 wv_check_ioaddr(u_long, /* ioaddr */
645 u_char *); /* mac address (read) */
646/* ---------------------- INTERRUPT HANDLING ---------------------- */
647static irqreturn_t
648 wavelan_interrupt(int, /* interrupt handler */
649 void *,
650 struct pt_regs *);
651static void
652 wavelan_watchdog(struct net_device *); /* transmission watchdog */
653/* ------------------- CONFIGURATION CALLBACKS ------------------- */
654static int
655 wavelan_open(struct net_device *), /* Open the device. */
656 wavelan_close(struct net_device *), /* Close the device. */
657 wavelan_config(struct net_device *, unsigned short);/* Configure one device. */
658extern struct net_device *wavelan_probe(int unit); /* See Space.c. */
659
660/**************************** VARIABLES ****************************/
661
662/*
663 * This is the root of the linked list of WaveLAN drivers
664 * It is use to verify that we don't reuse the same base address
665 * for two different drivers and to clean up when removing the module.
666 */
667static net_local * wavelan_list = (net_local *) NULL;
668
669/*
670 * This table is used to translate the PSA value to IRQ number
671 * and vice versa.
672 */
673static u_char irqvals[] =
674{
675 0, 0, 0, 0x01,
676 0x02, 0x04, 0, 0x08,
677 0, 0, 0x10, 0x20,
678 0x40, 0, 0, 0x80,
679};
680
681/*
682 * Table of the available I/O addresses (base addresses) for WaveLAN
683 */
684static unsigned short iobase[] =
685{
686#if 0
687 /* Leave out 0x3C0 for now -- seems to clash with some video
688 * controllers.
689 * Leave out the others too -- we will always use 0x390 and leave
690 * 0x300 for the Ethernet device.
691 * Jean II: 0x3E0 is fine as well.
692 */
693 0x300, 0x390, 0x3E0, 0x3C0
694#endif /* 0 */
695 0x390, 0x3E0
696};
697
698#ifdef MODULE
699/* Parameters set by insmod */
700static int io[4];
701static int irq[4];
702static char *name[4];
703module_param_array(io, int, NULL, 0);
704module_param_array(irq, int, NULL, 0);
705module_param_array(name, charp, NULL, 0);
706
707MODULE_PARM_DESC(io, "WaveLAN I/O base address(es),required");
708MODULE_PARM_DESC(irq, "WaveLAN IRQ number(s)");
709MODULE_PARM_DESC(name, "WaveLAN interface neme(s)");
710#endif /* MODULE */
711
712#endif /* WAVELAN_P_H */