| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | *	Wavelan Pcmcia 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 pcmcia driver. This file is a private header, so it should | 
|  | 10 | * be included only on wavelan_cs.c !!! | 
|  | 11 | */ | 
|  | 12 |  | 
|  | 13 | #ifndef WAVELAN_CS_P_H | 
|  | 14 | #define WAVELAN_CS_P_H | 
|  | 15 |  | 
|  | 16 | /************************** DOCUMENTATION **************************/ | 
|  | 17 | /* | 
|  | 18 | * This driver provide a Linux interface to the Wavelan Pcmcia 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)... | 
|  | 22 | * | 
|  | 23 | * To know how to use this driver, read the PCMCIA 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.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 WAVELAN_ROAMING, for the experimental roaming support. | 
|  | 62 | *	o SET_PSA_CRC, to have your card correctly recognised by | 
|  | 63 | *	  an access point and the Point-to-Point diagnostic tool. | 
|  | 64 | *	o USE_PSA_CONFIG, to read configuration from the PSA (EEprom) | 
|  | 65 | *	  (otherwise we always start afresh with some defaults) | 
|  | 66 | * | 
|  | 67 | * wavelan_cs.o is darn too big | 
|  | 68 | * ------------------------- | 
|  | 69 | *	That's true ! There is a very simple way to reduce the driver | 
|  | 70 | *	object by 33% (yes !). Comment out the following line : | 
|  | 71 | *		#include <linux/wireless.h> | 
|  | 72 | *	Other compile options can also reduce the size of it... | 
|  | 73 | * | 
|  | 74 | * MAC address and hardware detection : | 
|  | 75 | * ---------------------------------- | 
|  | 76 | *	The detection code of the wavelan chech that the first 3 | 
|  | 77 | *	octets of the MAC address fit the company code. This type of | 
|  | 78 | *	detection work well for AT&T cards (because the AT&T code is | 
|  | 79 | *	hardcoded in wavelan_cs.h), but of course will fail for other | 
|  | 80 | *	manufacturer. | 
|  | 81 | * | 
|  | 82 | *	If you are sure that your card is derived from the wavelan, | 
|  | 83 | *	here is the way to configure it : | 
|  | 84 | *	1) Get your MAC address | 
|  | 85 | *		a) With your card utilities (wfreqsel, instconf, ...) | 
|  | 86 | *		b) With the driver : | 
|  | 87 | *			o compile the kernel with DEBUG_CONFIG_INFO enabled | 
|  | 88 | *			o Boot and look the card messages | 
|  | 89 | *	2) Set your MAC code (3 octets) in MAC_ADDRESSES[][3] (wavelan_cs.h) | 
|  | 90 | *	3) Compile & verify | 
|  | 91 | *	4) Send me the MAC code - I will include it in the next version... | 
|  | 92 | * | 
|  | 93 | */ | 
|  | 94 |  | 
|  | 95 | /* --------------------- WIRELESS EXTENSIONS --------------------- */ | 
|  | 96 | /* | 
|  | 97 | * This driver is the first one to support "wireless extensions". | 
|  | 98 | * This set of extensions provide you some way to control the wireless | 
|  | 99 | * caracteristics of the hardware in a standard way and support for | 
|  | 100 | * applications for taking advantage of it (like Mobile IP). | 
|  | 101 | * | 
| Adrian Bunk | d86b5e0 | 2006-01-21 00:46:55 +0100 | [diff] [blame] | 102 | * It might be a good idea as well to fetch the wireless tools to | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | * configure the device and play a bit. | 
|  | 104 | */ | 
|  | 105 |  | 
|  | 106 | /* ---------------------------- FILES ---------------------------- */ | 
|  | 107 | /* | 
|  | 108 | * wavelan_cs.c :	The actual code for the driver - C functions | 
|  | 109 | * | 
|  | 110 | * wavelan_cs.p.h :	Private header : local types / vars for the driver | 
|  | 111 | * | 
|  | 112 | * wavelan_cs.h :	Description of the hardware interface & structs | 
|  | 113 | * | 
|  | 114 | * i82593.h :		Description if the Ethernet controller | 
|  | 115 | */ | 
|  | 116 |  | 
|  | 117 | /* --------------------------- HISTORY --------------------------- */ | 
|  | 118 | /* | 
|  | 119 | * The history of the Wavelan drivers is as complicated as history of | 
|  | 120 | * the Wavelan itself (NCR -> AT&T -> Lucent). | 
|  | 121 | * | 
|  | 122 | * All started with Anders Klemets <klemets@paul.rutgers.edu>, | 
| Robert P. J. Day | beb7dd8 | 2007-05-09 07:14:03 +0200 | [diff] [blame] | 123 | * writing a Wavelan ISA driver for the MACH microkernel. Girish | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | * Welling <welling@paul.rutgers.edu> had also worked on it. | 
|  | 125 | * Keith Moore modify this for the Pcmcia hardware. | 
|  | 126 | * | 
|  | 127 | * Robert Morris <rtm@das.harvard.edu> port these two drivers to BSDI | 
|  | 128 | * and add specific Pcmcia support (there is currently no equivalent | 
|  | 129 | * of the PCMCIA package under BSD...). | 
|  | 130 | * | 
|  | 131 | * Jim Binkley <jrb@cs.pdx.edu> port both BSDI drivers to FreeBSD. | 
|  | 132 | * | 
|  | 133 | * Bruce Janson <bruce@cs.usyd.edu.au> port the BSDI ISA driver to Linux. | 
|  | 134 | * | 
|  | 135 | * Anthony D. Joseph <adj@lcs.mit.edu> started modify Bruce driver | 
|  | 136 | * (with help of the BSDI PCMCIA driver) for PCMCIA. | 
|  | 137 | * Yunzhou Li <yunzhou@strat.iol.unh.edu> finished is work. | 
|  | 138 | * Joe Finney <joe@comp.lancs.ac.uk> patched the driver to start | 
|  | 139 | * correctly 2.00 cards (2.4 GHz with frequency selection). | 
|  | 140 | * David Hinds <dahinds@users.sourceforge.net> integrated the whole in his | 
|  | 141 | * Pcmcia package (+ bug corrections). | 
|  | 142 | * | 
|  | 143 | * I (Jean Tourrilhes - jt@hplb.hpl.hp.com) then started to make some | 
|  | 144 | * patchs to the Pcmcia driver. After, I added code in the ISA driver | 
|  | 145 | * for Wireless Extensions and full support of frequency selection | 
|  | 146 | * cards. Now, I'm doing the same to the Pcmcia driver + some | 
|  | 147 | * reorganisation. | 
|  | 148 | * Loeke Brederveld <lbrederv@wavelan.com> from Lucent has given me | 
|  | 149 | * much needed informations on the Wavelan hardware. | 
|  | 150 | */ | 
|  | 151 |  | 
|  | 152 | /* By the way : for the copyright & legal stuff : | 
|  | 153 | * Almost everybody wrote code under GNU or BSD license (or alike), | 
|  | 154 | * and want that their original copyright remain somewhere in the | 
|  | 155 | * code (for myself, I go with the GPL). | 
|  | 156 | * Nobody want to take responsibility for anything, except the fame... | 
|  | 157 | */ | 
|  | 158 |  | 
|  | 159 | /* --------------------------- CREDITS --------------------------- */ | 
|  | 160 | /* | 
|  | 161 | * Credits: | 
|  | 162 | *    Special thanks to Jan Hoogendoorn of AT&T GIS Utrecht and | 
|  | 163 | *	Loeke Brederveld of Lucent for providing extremely useful | 
|  | 164 | *	information about WaveLAN PCMCIA hardware | 
|  | 165 | * | 
|  | 166 | *    This driver is based upon several other drivers, in particular: | 
|  | 167 | *	David Hinds' Linux driver for the PCMCIA 3c589 ethernet adapter | 
|  | 168 | *	Bruce Janson's Linux driver for the AT-bus WaveLAN adapter | 
|  | 169 | *	Anders Klemets' PCMCIA WaveLAN adapter driver | 
|  | 170 | *	Robert Morris' BSDI driver for the PCMCIA WaveLAN adapter | 
|  | 171 | * | 
|  | 172 | * Additional Credits: | 
|  | 173 | * | 
|  | 174 | *    This software was originally developed under Linux 1.2.3 | 
|  | 175 | *	(Slackware 2.0 distribution). | 
|  | 176 | *    And then under Linux 2.0.x (Debian 1.1 -> 2.2 - pcmcia 2.8.18+) | 
|  | 177 | *	with an HP OmniBook 4000 and then a 5500. | 
|  | 178 | * | 
|  | 179 | *    It is based on other device drivers and information either written | 
|  | 180 | *    or supplied by: | 
|  | 181 | *	James Ashton (jaa101@syseng.anu.edu.au), | 
|  | 182 | *	Ajay Bakre (bakre@paul.rutgers.edu), | 
|  | 183 | *	Donald Becker (becker@super.org), | 
|  | 184 | *	Jim Binkley <jrb@cs.pdx.edu>, | 
|  | 185 | *	Loeke Brederveld <lbrederv@wavelan.com>, | 
|  | 186 | *	Allan Creighton (allanc@cs.su.oz.au), | 
|  | 187 | *	Brent Elphick <belphick@uwaterloo.ca>, | 
|  | 188 | *	Joe Finney <joe@comp.lancs.ac.uk>, | 
|  | 189 | *	Matthew Geier (matthew@cs.su.oz.au), | 
|  | 190 | *	Remo di Giovanni (remo@cs.su.oz.au), | 
|  | 191 | *	Mark Hagan (mhagan@wtcpost.daytonoh.NCR.COM), | 
|  | 192 | *	David Hinds <dahinds@users.sourceforge.net>, | 
|  | 193 | *	Jan Hoogendoorn (c/o marteijn@lucent.com), | 
|  | 194 | *      Bruce Janson <bruce@cs.usyd.edu.au>, | 
|  | 195 | *	Anthony D. Joseph <adj@lcs.mit.edu>, | 
|  | 196 | *	Anders Klemets (klemets@paul.rutgers.edu), | 
|  | 197 | *	Yunzhou Li <yunzhou@strat.iol.unh.edu>, | 
|  | 198 | *	Marc Meertens (mmeertens@lucent.com), | 
|  | 199 | *	Keith Moore, | 
|  | 200 | *	Robert Morris (rtm@das.harvard.edu), | 
|  | 201 | *	Ian Parkin (ian@cs.su.oz.au), | 
|  | 202 | *	John Rosenberg (johnr@cs.su.oz.au), | 
|  | 203 | *	George Rossi (george@phm.gov.au), | 
|  | 204 | *	Arthur Scott (arthur@cs.su.oz.au), | 
|  | 205 | *	Stanislav Sinyagin <stas@isf.ru> | 
|  | 206 | *	Peter Storey, | 
|  | 207 | *	Jean Tourrilhes <jt@hpl.hp.com>, | 
|  | 208 | *	Girish Welling (welling@paul.rutgers.edu) | 
|  | 209 | *	Clark Woodworth <clark@hiway1.exit109.com> | 
|  | 210 | *	Yongguang Zhang <ygz@isl.hrl.hac.com>... | 
|  | 211 | */ | 
|  | 212 |  | 
|  | 213 | /* ------------------------- IMPROVEMENTS ------------------------- */ | 
|  | 214 | /* | 
|  | 215 | * I proudly present : | 
|  | 216 | * | 
|  | 217 | * Changes made in 2.8.22 : | 
|  | 218 | * ---------------------- | 
|  | 219 | *	- improved wv_set_multicast_list | 
|  | 220 | *	- catch spurious interrupt | 
|  | 221 | *	- correct release of the device | 
|  | 222 | * | 
|  | 223 | * Changes mades in release : | 
|  | 224 | * ------------------------ | 
|  | 225 | *	- Reorganisation of the code, function name change | 
|  | 226 | *	- Creation of private header (wavelan_cs.h) | 
|  | 227 | *	- Reorganised debug messages | 
|  | 228 | *	- More comments, history, ... | 
|  | 229 | *	- Configure earlier (in "insert" instead of "open") | 
|  | 230 | *        and do things only once | 
|  | 231 | *	- mmc_init : configure the PSA if not done | 
|  | 232 | *	- mmc_init : 2.00 detection better code for 2.00 init | 
|  | 233 | *	- better info at startup | 
|  | 234 | *	- Correct a HUGE bug (volatile & uncalibrated busy loop) | 
|  | 235 | *	  in wv_82593_cmd => config speedup | 
|  | 236 | *	- Stop receiving & power down on close (and power up on open) | 
|  | 237 | *	  use "ifconfig down" & "ifconfig up ; route add -net ..." | 
|  | 238 | *	- Send packets : add watchdog instead of pooling | 
|  | 239 | *	- Receive : check frame wrap around & try to recover some frames | 
|  | 240 | *	- wavelan_set_multicast_list : avoid reset | 
|  | 241 | *	- add wireless extensions (ioctl & get_wireless_stats) | 
|  | 242 | *	  get/set nwid/frequency on fly, info for /proc/net/wireless | 
|  | 243 | *	- Suppress useless stuff from lp (net_local), but add link | 
|  | 244 | *	- More inlines | 
|  | 245 | *	- Lot of others minor details & cleanups | 
|  | 246 | * | 
|  | 247 | * Changes made in second release : | 
|  | 248 | * ------------------------------ | 
|  | 249 | *	- Optimise wv_85893_reconfig stuff, fix potential problems | 
|  | 250 | *	- Change error values for ioctl | 
|  | 251 | *	- Non blocking wv_ru_stop() + call wv_reset() in case of problems | 
|  | 252 | *	- Remove development printk from wavelan_watchdog() | 
|  | 253 | *	- Remove of the watchdog to wavelan_close instead of wavelan_release | 
|  | 254 | *	  fix potential problems... | 
|  | 255 | *	- Start debugging suspend stuff (but it's still a bit weird) | 
|  | 256 | *	- Debug & optimize dump header/packet in Rx & Tx (debug) | 
|  | 257 | *	- Use "readb" and "writeb" to be kernel 2.1 compliant | 
|  | 258 | *	- Better handling of bogus interrupts | 
|  | 259 | *	- Wireless extension : SETSPY and GETSPY | 
|  | 260 | *	- Remove old stuff (stats - for those needing it, just ask me...) | 
|  | 261 | *	- Make wireless extensions optional | 
|  | 262 | * | 
|  | 263 | * Changes made in third release : | 
|  | 264 | * ----------------------------- | 
|  | 265 | *	- cleanups & typos | 
|  | 266 | *	- modif wireless ext (spy -> only one pointer) | 
|  | 267 | *	- new private ioctl to set/get quality & level threshold | 
|  | 268 | *	- Init : correct default value of level threshold for pcmcia | 
|  | 269 | *	- kill watchdog in hw_reset | 
|  | 270 | *	- more 2.1 support (copy_to/from_user instead of memcpy_to/fromfs) | 
|  | 271 | *	- Add message level (debug stuff in /var/adm/debug & errors not | 
|  | 272 | *	  displayed at console and still in /var/adm/messages) | 
|  | 273 | * | 
|  | 274 | * Changes made in fourth release : | 
|  | 275 | * ------------------------------ | 
|  | 276 | *	- multicast support (yes !) thanks to Yongguang Zhang. | 
|  | 277 | * | 
|  | 278 | * Changes made in fifth release (2.9.0) : | 
|  | 279 | * ------------------------------------- | 
|  | 280 | *	- Revisited multicast code (it was mostly wrong). | 
|  | 281 | *	- protect code in wv_82593_reconfig with dev->tbusy (oups !) | 
|  | 282 | * | 
|  | 283 | * Changes made in sixth release (2.9.1a) : | 
|  | 284 | * -------------------------------------- | 
|  | 285 | *	- Change the detection code for multi manufacturer code support | 
|  | 286 | *	- Correct bug (hang kernel) in init when we were "rejecting" a card | 
|  | 287 | * | 
|  | 288 | * Changes made in seventh release (2.9.1b) : | 
|  | 289 | * ---------------------------------------- | 
|  | 290 | *	- Update to wireless extensions changes | 
|  | 291 | *	- Silly bug in card initial configuration (psa_conf_status) | 
|  | 292 | * | 
|  | 293 | * Changes made in eigth release : | 
|  | 294 | * ----------------------------- | 
|  | 295 | *	- Small bug in debug code (probably not the last one...) | 
|  | 296 | *	- 1.2.13 support (thanks to Clark Woodworth) | 
|  | 297 | * | 
|  | 298 | * Changes made for release in 2.9.2b : | 
|  | 299 | * ---------------------------------- | 
|  | 300 | *	- Level threshold is now a standard wireless extension (version 4 !) | 
|  | 301 | *	- modules parameters types for kernel > 2.1.17 | 
|  | 302 | *	- updated man page | 
|  | 303 | *	- Others cleanup from David Hinds | 
|  | 304 | * | 
|  | 305 | * Changes made for release in 2.9.5 : | 
|  | 306 | * --------------------------------- | 
|  | 307 | *	- byte count stats (courtesy of David Hinds) | 
|  | 308 | *	- Remove dev_tint stuff (courtesy of David Hinds) | 
|  | 309 | *	- Others cleanup from David Hinds | 
|  | 310 | *	- Encryption setting from Brent Elphick (thanks a lot !) | 
|  | 311 | *	- 'base' to 'u_long' for the Alpha (thanks to Stanislav Sinyagin) | 
|  | 312 | * | 
|  | 313 | * Changes made for release in 2.9.6 : | 
|  | 314 | * --------------------------------- | 
|  | 315 | *	- fix bug : no longuer disable watchdog in case of bogus interrupt | 
|  | 316 | *	- increase timeout in config code for picky hardware | 
|  | 317 | *	- mask unused bits in status (Wireless Extensions) | 
|  | 318 | * | 
|  | 319 | * Changes integrated by Justin Seger <jseger@MIT.EDU> & David Hinds : | 
|  | 320 | * ----------------------------------------------------------------- | 
|  | 321 | *	- Roaming "hack" from Joe Finney <joe@comp.lancs.ac.uk> | 
|  | 322 | *	- PSA CRC code from Bob Gray <rgray@bald.cs.dartmouth.edu> | 
|  | 323 | *	- Better initialisation of the i82593 controller | 
|  | 324 | *	  from Joseph K. O'Sullivan <josullvn+@cs.cmu.edu> | 
|  | 325 | * | 
|  | 326 | * Changes made for release in 3.0.10 : | 
|  | 327 | * ---------------------------------- | 
|  | 328 | *	- Fix eject "hang" of the driver under 2.2.X : | 
|  | 329 | *		o create wv_flush_stale_links() | 
|  | 330 | *		o Rename wavelan_release to wv_pcmcia_release & move up | 
|  | 331 | *		o move unregister_netdev to wavelan_detach() | 
|  | 332 | *		o wavelan_release() no longer call wavelan_detach() | 
|  | 333 | *		o Suppress "release" timer | 
|  | 334 | *		o Other cleanups & fixes | 
|  | 335 | *	- New MAC address in the probe | 
|  | 336 | *	- Reorg PSA_CRC code (endian neutral & cleaner) | 
|  | 337 | *	- Correct initialisation of the i82593 from Lucent manual | 
|  | 338 | *	- Put back the watchdog, with larger timeout | 
|  | 339 | *	- TRANSMIT_NO_CRC is a "normal" error, so recover from it | 
|  | 340 | *	  from Derrick J Brashear <shadow@dementia.org> | 
|  | 341 | *	- Better handling of TX and RX normal failure conditions | 
|  | 342 | *	- #ifdef out all the roaming code | 
|  | 343 | *	- Add ESSID & "AP current address" ioctl stubs | 
|  | 344 | *	- General cleanup of the code | 
|  | 345 | * | 
|  | 346 | * Changes made for release in 3.0.13 : | 
|  | 347 | * ---------------------------------- | 
|  | 348 | *	- Re-enable compilation of roaming code by default, but with | 
|  | 349 | *	  do_roaming = 0 | 
|  | 350 | *	- Nuke `nwid=nwid^ntohs(beacon->domain_id)' in wl_roam_gather | 
|  | 351 | *	  at the demand of John Carol Langford <jcl@gs176.sp.cs.cmu.edu> | 
|  | 352 | *	- Introduced WAVELAN_ROAMING_EXT for incomplete ESSID stuff. | 
|  | 353 | * | 
|  | 354 | * Changes made for release in 3.0.15 : | 
|  | 355 | * ---------------------------------- | 
|  | 356 | *	- Change e-mail and web page addresses | 
|  | 357 | *	- Watchdog timer is now correctly expressed in HZ, not in jiffies | 
|  | 358 | *	- Add channel number to the list of frequencies in range | 
|  | 359 | *	- Add the (short) list of bit-rates in range | 
|  | 360 | *	- Developp a new sensitivity... (sens.value & sens.fixed) | 
|  | 361 | * | 
|  | 362 | * Changes made for release in 3.1.2 : | 
|  | 363 | * --------------------------------- | 
|  | 364 | *	- Fix check for root permission (break instead of exit) | 
|  | 365 | *	- New nwid & encoding setting (Wireless Extension 9) | 
|  | 366 | * | 
|  | 367 | * Changes made for release in 3.1.12 : | 
|  | 368 | * ---------------------------------- | 
|  | 369 | *	- reworked wv_82593_cmd to avoid using the IRQ handler and doing | 
|  | 370 | *	  ugly things with interrupts. | 
|  | 371 | *	- Add IRQ protection in 82593_config/ru_start/ru_stop/watchdog | 
|  | 372 | *	- Update to new network API (softnet - 2.3.43) : | 
|  | 373 | *		o replace dev->tbusy (David + me) | 
|  | 374 | *		o replace dev->tstart (David + me) | 
|  | 375 | *		o remove dev->interrupt (David) | 
|  | 376 | *		o add SMP locking via spinlock in splxx (me) | 
|  | 377 | *		o add spinlock in interrupt handler (me) | 
|  | 378 | *		o use kernel watchdog instead of ours (me) | 
|  | 379 | *		o verify that all the changes make sense and work (me) | 
|  | 380 | *	- Re-sync kernel/pcmcia versions (not much actually) | 
|  | 381 | *	- A few other cleanups (David & me)... | 
|  | 382 | * | 
|  | 383 | * Changes made for release in 3.1.22 : | 
|  | 384 | * ---------------------------------- | 
|  | 385 | *	- Check that SMP works, remove annoying log message | 
|  | 386 | * | 
|  | 387 | * Changes made for release in 3.1.24 : | 
|  | 388 | * ---------------------------------- | 
|  | 389 | *	- Fix unfrequent card lockup when watchdog was reseting the hardware : | 
|  | 390 | *		o control first busy loop in wv_82593_cmd() | 
|  | 391 | *		o Extend spinlock protection in wv_hw_config() | 
|  | 392 | * | 
|  | 393 | * Changes made for release in 3.1.33 : | 
|  | 394 | * ---------------------------------- | 
|  | 395 | *	- Optional use new driver API for Wireless Extensions : | 
|  | 396 | *		o got rid of wavelan_ioctl() | 
|  | 397 | *		o use a bunch of iw_handler instead | 
|  | 398 | * | 
|  | 399 | * Changes made for release in 3.2.1 : | 
|  | 400 | * --------------------------------- | 
|  | 401 | *	- Set dev->trans_start to avoid filling the logs | 
|  | 402 | *		(and generating useless abort commands) | 
|  | 403 | *	- Avoid deadlocks in mmc_out()/mmc_in() | 
|  | 404 | * | 
|  | 405 | * Wishes & dreams: | 
|  | 406 | * ---------------- | 
|  | 407 | *	- Cleanup and integrate the roaming code | 
|  | 408 | *	  (std debug, set DomainID, decay avg and co...) | 
|  | 409 | */ | 
|  | 410 |  | 
|  | 411 | /***************************** INCLUDES *****************************/ | 
|  | 412 |  | 
|  | 413 | /* Linux headers that we need */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | #include <linux/module.h> | 
|  | 415 | #include <linux/kernel.h> | 
|  | 416 | #include <linux/init.h> | 
|  | 417 | #include <linux/sched.h> | 
|  | 418 | #include <linux/ptrace.h> | 
|  | 419 | #include <linux/slab.h> | 
|  | 420 | #include <linux/string.h> | 
|  | 421 | #include <linux/timer.h> | 
|  | 422 | #include <linux/interrupt.h> | 
|  | 423 | #include <linux/spinlock.h> | 
|  | 424 | #include <linux/in.h> | 
|  | 425 | #include <linux/delay.h> | 
|  | 426 | #include <linux/bitops.h> | 
|  | 427 | #include <asm/uaccess.h> | 
|  | 428 | #include <asm/io.h> | 
|  | 429 | #include <asm/system.h> | 
|  | 430 |  | 
|  | 431 | #include <linux/netdevice.h> | 
|  | 432 | #include <linux/etherdevice.h> | 
|  | 433 | #include <linux/skbuff.h> | 
|  | 434 | #include <linux/if_arp.h> | 
|  | 435 | #include <linux/ioport.h> | 
|  | 436 | #include <linux/fcntl.h> | 
|  | 437 | #include <linux/ethtool.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | #include <linux/wireless.h>		/* Wireless extensions */ | 
|  | 439 | #include <net/iw_handler.h>		/* New driver API */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 |  | 
|  | 441 | /* Pcmcia headers that we need */ | 
|  | 442 | #include <pcmcia/cs_types.h> | 
|  | 443 | #include <pcmcia/cs.h> | 
|  | 444 | #include <pcmcia/cistpl.h> | 
|  | 445 | #include <pcmcia/cisreg.h> | 
|  | 446 | #include <pcmcia/ds.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 |  | 
|  | 448 | /* Wavelan declarations */ | 
|  | 449 | #include "i82593.h"	/* Definitions for the Intel chip */ | 
|  | 450 |  | 
|  | 451 | #include "wavelan_cs.h"	/* Others bits of the hardware */ | 
|  | 452 |  | 
|  | 453 | /************************** DRIVER OPTIONS **************************/ | 
|  | 454 | /* | 
|  | 455 | * `#define' or `#undef' the following constant to change the behaviour | 
|  | 456 | * of the driver... | 
|  | 457 | */ | 
|  | 458 | #define WAVELAN_ROAMING		/* Include experimental roaming code */ | 
|  | 459 | #undef WAVELAN_ROAMING_EXT	/* Enable roaming wireless extensions */ | 
|  | 460 | #undef SET_PSA_CRC		/* Set the CRC in PSA (slower) */ | 
|  | 461 | #define USE_PSA_CONFIG		/* Use info from the PSA */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | #undef EEPROM_IS_PROTECTED	/* Doesn't seem to be necessary */ | 
|  | 463 | #define MULTICAST_AVOID		/* Avoid extra multicast (I'm sceptical) */ | 
|  | 464 | #undef SET_MAC_ADDRESS		/* Experimental */ | 
|  | 465 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | /* Warning : these stuff will slow down the driver... */ | 
|  | 467 | #define WIRELESS_SPY		/* Enable spying addresses */ | 
|  | 468 | #undef HISTOGRAM		/* Enable histogram of sig level... */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 |  | 
|  | 470 | /****************************** DEBUG ******************************/ | 
|  | 471 |  | 
|  | 472 | #undef DEBUG_MODULE_TRACE	/* Module insertion/removal */ | 
|  | 473 | #undef DEBUG_CALLBACK_TRACE	/* Calls made by Linux */ | 
|  | 474 | #undef DEBUG_INTERRUPT_TRACE	/* Calls to handler */ | 
|  | 475 | #undef DEBUG_INTERRUPT_INFO	/* type of interrupt & so on */ | 
|  | 476 | #define DEBUG_INTERRUPT_ERROR	/* problems */ | 
|  | 477 | #undef DEBUG_CONFIG_TRACE	/* Trace the config functions */ | 
|  | 478 | #undef DEBUG_CONFIG_INFO	/* What's going on... */ | 
|  | 479 | #define DEBUG_CONFIG_ERRORS	/* Errors on configuration */ | 
|  | 480 | #undef DEBUG_TX_TRACE		/* Transmission calls */ | 
|  | 481 | #undef DEBUG_TX_INFO		/* Header of the transmitted packet */ | 
|  | 482 | #undef DEBUG_TX_FAIL		/* Normal failure conditions */ | 
|  | 483 | #define DEBUG_TX_ERROR		/* Unexpected conditions */ | 
|  | 484 | #undef DEBUG_RX_TRACE		/* Transmission calls */ | 
|  | 485 | #undef DEBUG_RX_INFO		/* Header of the transmitted packet */ | 
|  | 486 | #undef DEBUG_RX_FAIL		/* Normal failure conditions */ | 
|  | 487 | #define DEBUG_RX_ERROR		/* Unexpected conditions */ | 
|  | 488 | #undef DEBUG_PACKET_DUMP	/* Dump packet on the screen */ | 
|  | 489 | #undef DEBUG_IOCTL_TRACE	/* Misc call by Linux */ | 
|  | 490 | #undef DEBUG_IOCTL_INFO		/* Various debug info */ | 
|  | 491 | #define DEBUG_IOCTL_ERROR	/* What's going wrong */ | 
|  | 492 | #define DEBUG_BASIC_SHOW	/* Show basic startup info */ | 
|  | 493 | #undef DEBUG_VERSION_SHOW	/* Print version info */ | 
|  | 494 | #undef DEBUG_PSA_SHOW		/* Dump psa to screen */ | 
|  | 495 | #undef DEBUG_MMC_SHOW		/* Dump mmc to screen */ | 
|  | 496 | #undef DEBUG_SHOW_UNUSED	/* Show also unused fields */ | 
|  | 497 | #undef DEBUG_I82593_SHOW	/* Show i82593 status */ | 
|  | 498 | #undef DEBUG_DEVICE_SHOW	/* Show device parameters */ | 
|  | 499 |  | 
|  | 500 | /************************ CONSTANTS & MACROS ************************/ | 
|  | 501 |  | 
|  | 502 | #ifdef DEBUG_VERSION_SHOW | 
|  | 503 | static const char *version = "wavelan_cs.c : v24 (SMP + wireless extensions) 11/1/02\n"; | 
|  | 504 | #endif | 
|  | 505 |  | 
|  | 506 | /* Watchdog temporisation */ | 
|  | 507 | #define	WATCHDOG_JIFFIES	(256*HZ/100) | 
|  | 508 |  | 
|  | 509 | /* Fix a bug in some old wireless extension definitions */ | 
|  | 510 | #ifndef IW_ESSID_MAX_SIZE | 
|  | 511 | #define IW_ESSID_MAX_SIZE	32 | 
|  | 512 | #endif | 
|  | 513 |  | 
|  | 514 | /* ------------------------ PRIVATE IOCTL ------------------------ */ | 
|  | 515 |  | 
|  | 516 | #define SIOCSIPQTHR	SIOCIWFIRSTPRIV		/* Set quality threshold */ | 
|  | 517 | #define SIOCGIPQTHR	SIOCIWFIRSTPRIV + 1	/* Get quality threshold */ | 
|  | 518 | #define SIOCSIPROAM     SIOCIWFIRSTPRIV + 2	/* Set roaming state */ | 
|  | 519 | #define SIOCGIPROAM     SIOCIWFIRSTPRIV + 3	/* Get roaming state */ | 
|  | 520 |  | 
|  | 521 | #define SIOCSIPHISTO	SIOCIWFIRSTPRIV + 4	/* Set histogram ranges */ | 
|  | 522 | #define SIOCGIPHISTO	SIOCIWFIRSTPRIV + 5	/* Get histogram values */ | 
|  | 523 |  | 
|  | 524 | /*************************** WaveLAN Roaming  **************************/ | 
|  | 525 | #ifdef WAVELAN_ROAMING		/* Conditional compile, see above in options */ | 
|  | 526 |  | 
|  | 527 | #define WAVELAN_ROAMING_DEBUG	 0	/* 1 = Trace of handover decisions */ | 
|  | 528 | /* 2 = Info on each beacon rcvd... */ | 
|  | 529 | #define MAX_WAVEPOINTS		7	/* Max visible at one time */ | 
|  | 530 | #define WAVEPOINT_HISTORY	5	/* SNR sample history slow search */ | 
|  | 531 | #define WAVEPOINT_FAST_HISTORY	2	/* SNR sample history fast search */ | 
|  | 532 | #define SEARCH_THRESH_LOW	10	/* SNR to enter cell search */ | 
|  | 533 | #define SEARCH_THRESH_HIGH	13	/* SNR to leave cell search */ | 
|  | 534 | #define WAVELAN_ROAMING_DELTA	1	/* Hysteresis value (+/- SNR) */ | 
|  | 535 | #define CELL_TIMEOUT		2*HZ	/* in jiffies */ | 
|  | 536 |  | 
|  | 537 | #define FAST_CELL_SEARCH	1	/* Boolean values... */ | 
|  | 538 | #define NWID_PROMISC		1	/* for code clarity. */ | 
|  | 539 |  | 
|  | 540 | typedef struct wavepoint_beacon | 
|  | 541 | { | 
|  | 542 | unsigned char		dsap,		/* Unused */ | 
|  | 543 | ssap,		/* Unused */ | 
|  | 544 | ctrl,		/* Unused */ | 
|  | 545 | O,U,I,		/* Unused */ | 
|  | 546 | spec_id1,	/* Unused */ | 
|  | 547 | spec_id2,	/* Unused */ | 
|  | 548 | pdu_type,	/* Unused */ | 
|  | 549 | seq;		/* WavePoint beacon sequence number */ | 
| Al Viro | 0e5ce1f | 2007-12-22 13:45:50 -0500 | [diff] [blame] | 550 | __be16		domain_id,	/* WavePoint Domain ID */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | nwid;		/* WavePoint NWID */ | 
|  | 552 | } wavepoint_beacon; | 
|  | 553 |  | 
|  | 554 | typedef struct wavepoint_history | 
|  | 555 | { | 
|  | 556 | unsigned short	nwid;		/* WavePoint's NWID */ | 
|  | 557 | int			average_slow;	/* SNR running average */ | 
|  | 558 | int			average_fast;	/* SNR running average */ | 
|  | 559 | unsigned char	  sigqual[WAVEPOINT_HISTORY]; /* Ringbuffer of recent SNR's */ | 
|  | 560 | unsigned char		qualptr;	/* Index into ringbuffer */ | 
|  | 561 | unsigned char		last_seq;	/* Last seq. no seen for WavePoint */ | 
|  | 562 | struct wavepoint_history *next;	/* Next WavePoint in table */ | 
|  | 563 | struct wavepoint_history *prev;	/* Previous WavePoint in table */ | 
|  | 564 | unsigned long		last_seen;	/* Time of last beacon recvd, jiffies */ | 
|  | 565 | } wavepoint_history; | 
|  | 566 |  | 
|  | 567 | struct wavepoint_table | 
|  | 568 | { | 
|  | 569 | wavepoint_history	*head;		/* Start of ringbuffer */ | 
|  | 570 | int			num_wavepoints;	/* No. of WavePoints visible */ | 
|  | 571 | unsigned char		locked;		/* Table lock */ | 
|  | 572 | }; | 
|  | 573 |  | 
|  | 574 | #endif	/* WAVELAN_ROAMING */ | 
|  | 575 |  | 
|  | 576 | /****************************** TYPES ******************************/ | 
|  | 577 |  | 
|  | 578 | /* Shortcuts */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 579 | typedef struct iw_statistics	iw_stats; | 
|  | 580 | typedef struct iw_quality	iw_qual; | 
|  | 581 | typedef struct iw_freq		iw_freq; | 
|  | 582 | typedef struct net_local	net_local; | 
|  | 583 | typedef struct timer_list	timer_list; | 
|  | 584 |  | 
|  | 585 | /* Basic types */ | 
|  | 586 | typedef u_char		mac_addr[WAVELAN_ADDR_SIZE];	/* Hardware address */ | 
|  | 587 |  | 
|  | 588 | /* | 
|  | 589 | * Static specific data for the interface. | 
|  | 590 | * | 
|  | 591 | * For each network interface, Linux keep data in two structure. "device" | 
|  | 592 | * keep the generic data (same format for everybody) and "net_local" keep | 
|  | 593 | * the additional specific data. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 594 | */ | 
|  | 595 | struct net_local | 
|  | 596 | { | 
|  | 597 | dev_node_t 	node;		/* ???? What is this stuff ???? */ | 
|  | 598 | struct net_device *	dev;		/* Reverse link... */ | 
|  | 599 | spinlock_t	spinlock;	/* Serialize access to the hardware (SMP) */ | 
| Dominik Brodowski | fba395e | 2006-03-31 17:21:06 +0200 | [diff] [blame] | 600 | struct pcmcia_device *	link;		/* pcmcia structure */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | int		nresets;	/* Number of hw resets */ | 
|  | 602 | u_char	configured;	/* If it is configured */ | 
|  | 603 | u_char	reconfig_82593;	/* Need to reconfigure the controller */ | 
|  | 604 | u_char	promiscuous;	/* Promiscuous mode */ | 
|  | 605 | u_char	allmulticast;	/* All Multicast mode */ | 
|  | 606 | int		mc_count;	/* Number of multicast addresses */ | 
|  | 607 |  | 
|  | 608 | int   	stop;		/* Current i82593 Stop Hit Register */ | 
|  | 609 | int   	rfp;		/* Last DMA machine receive pointer */ | 
|  | 610 | int		overrunning;	/* Receiver overrun flag */ | 
|  | 611 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | iw_stats	wstats;		/* Wireless specific stats */ | 
|  | 613 |  | 
|  | 614 | struct iw_spy_data	spy_data; | 
|  | 615 | struct iw_public_data	wireless_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 616 |  | 
|  | 617 | #ifdef HISTOGRAM | 
|  | 618 | int		his_number;		/* Number of intervals */ | 
|  | 619 | u_char	his_range[16];		/* Boundaries of interval ]n-1; n] */ | 
|  | 620 | u_long	his_sum[16];		/* Sum in interval */ | 
|  | 621 | #endif	/* HISTOGRAM */ | 
|  | 622 | #ifdef WAVELAN_ROAMING | 
|  | 623 | u_long	domain_id;	/* Domain ID we lock on for roaming */ | 
|  | 624 | int		filter_domains;	/* Check Domain ID of beacon found */ | 
|  | 625 | struct wavepoint_table	wavepoint_table;	/* Table of visible WavePoints*/ | 
|  | 626 | wavepoint_history *	curr_point;		/* Current wavepoint */ | 
|  | 627 | int			cell_search;		/* Searching for new cell? */ | 
|  | 628 | struct timer_list	cell_timer;		/* Garbage collection */ | 
|  | 629 | #endif	/* WAVELAN_ROAMING */ | 
|  | 630 | void __iomem *mem; | 
|  | 631 | }; | 
|  | 632 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 633 | /* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */ | 
|  | 634 | static inline u_char		/* data */ | 
|  | 635 | hasr_read(u_long);	/* Read the host interface : base address */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 636 | static void | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 637 | hacr_write(u_long,	/* Write to host interface : base address */ | 
|  | 638 | u_char),	/* data */ | 
|  | 639 | hacr_write_slow(u_long, | 
|  | 640 | u_char); | 
|  | 641 | static void | 
|  | 642 | psa_read(struct net_device *,	/* Read the Parameter Storage Area */ | 
|  | 643 | int,		/* offset in PSA */ | 
|  | 644 | u_char *,	/* buffer to fill */ | 
|  | 645 | int),		/* size to read */ | 
|  | 646 | psa_write(struct net_device *,	/* Write to the PSA */ | 
|  | 647 | int,		/* Offset in psa */ | 
|  | 648 | u_char *,	/* Buffer in memory */ | 
|  | 649 | int);		/* Length of buffer */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 650 | static void | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | mmc_out(u_long,		/* Write 1 byte to the Modem Manag Control */ | 
|  | 652 | u_short, | 
|  | 653 | u_char), | 
|  | 654 | mmc_write(u_long,	/* Write n bytes to the MMC */ | 
|  | 655 | u_char, | 
|  | 656 | u_char *, | 
|  | 657 | int); | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 658 | static u_char			/* Read 1 byte from the MMC */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | mmc_in(u_long, | 
|  | 660 | u_short); | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 661 | static void | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | mmc_read(u_long,	/* Read n bytes from the MMC */ | 
|  | 663 | u_char, | 
|  | 664 | u_char *, | 
|  | 665 | int), | 
|  | 666 | fee_wait(u_long,	/* Wait for frequency EEprom : base address */ | 
|  | 667 | int,		/* Base delay to wait for */ | 
|  | 668 | int);		/* Number of time to wait */ | 
|  | 669 | static void | 
|  | 670 | fee_read(u_long,	/* Read the frequency EEprom : base address */ | 
|  | 671 | u_short,	/* destination offset */ | 
|  | 672 | u_short *,	/* data buffer */ | 
|  | 673 | int);		/* number of registers */ | 
|  | 674 | /* ---------------------- I82593 SUBROUTINES ----------------------- */ | 
|  | 675 | static int | 
|  | 676 | wv_82593_cmd(struct net_device *,	/* synchronously send a command to i82593 */ | 
|  | 677 | char *, | 
|  | 678 | int, | 
|  | 679 | int); | 
|  | 680 | static inline int | 
|  | 681 | wv_diag(struct net_device *);	/* Diagnostique the i82593 */ | 
|  | 682 | static int | 
|  | 683 | read_ringbuf(struct net_device *,	/* Read a receive buffer */ | 
|  | 684 | int, | 
|  | 685 | char *, | 
|  | 686 | int); | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 687 | static void | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 688 | wv_82593_reconfig(struct net_device *);	/* Reconfigure the controller */ | 
|  | 689 | /* ------------------- DEBUG & INFO SUBROUTINES ------------------- */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 690 | static void | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | wv_init_info(struct net_device *);	/* display startup info */ | 
|  | 692 | /* ------------------- IOCTL, STATS & RECONFIG ------------------- */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | static iw_stats * | 
|  | 694 | wavelan_get_wireless_stats(struct net_device *); | 
|  | 695 | /* ----------------------- PACKET RECEPTION ----------------------- */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 696 | static int | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | wv_start_of_frame(struct net_device *,	/* Seek beggining of current frame */ | 
|  | 698 | int,	/* end of frame */ | 
|  | 699 | int);	/* start of buffer */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 700 | static void | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 701 | wv_packet_read(struct net_device *,	/* Read a packet from a frame */ | 
|  | 702 | int, | 
|  | 703 | int), | 
|  | 704 | wv_packet_rcv(struct net_device *);	/* Read all packets waiting */ | 
|  | 705 | /* --------------------- PACKET TRANSMISSION --------------------- */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 706 | static void | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | wv_packet_write(struct net_device *,	/* Write a packet to the Tx buffer */ | 
|  | 708 | void *, | 
|  | 709 | short); | 
|  | 710 | static int | 
|  | 711 | wavelan_packet_xmit(struct sk_buff *,	/* Send a packet */ | 
|  | 712 | struct net_device *); | 
|  | 713 | /* -------------------- HARDWARE CONFIGURATION -------------------- */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 714 | static int | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | wv_mmc_init(struct net_device *);	/* Initialize the modem */ | 
|  | 716 | static int | 
|  | 717 | wv_ru_stop(struct net_device *),	/* Stop the i82593 receiver unit */ | 
|  | 718 | wv_ru_start(struct net_device *);	/* Start the i82593 receiver unit */ | 
|  | 719 | static int | 
|  | 720 | wv_82593_config(struct net_device *);	/* Configure the i82593 */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 721 | static int | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 722 | wv_pcmcia_reset(struct net_device *);	/* Reset the pcmcia interface */ | 
|  | 723 | static int | 
|  | 724 | wv_hw_config(struct net_device *);	/* Reset & configure the whole hardware */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 725 | static void | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 726 | wv_hw_reset(struct net_device *);	/* Same, + start receiver unit */ | 
| Denys Vlasenko | 2aee82d | 2008-04-01 02:56:32 +0200 | [diff] [blame] | 727 | static int | 
| Dominik Brodowski | fba395e | 2006-03-31 17:21:06 +0200 | [diff] [blame] | 728 | wv_pcmcia_config(struct pcmcia_device *);	/* Configure the pcmcia interface */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | static void | 
| Dominik Brodowski | fba395e | 2006-03-31 17:21:06 +0200 | [diff] [blame] | 730 | wv_pcmcia_release(struct pcmcia_device *);/* Remove a device */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 731 | /* ---------------------- INTERRUPT HANDLING ---------------------- */ | 
|  | 732 | static irqreturn_t | 
|  | 733 | wavelan_interrupt(int,	/* Interrupt handler */ | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 734 | void *); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 735 | static void | 
|  | 736 | wavelan_watchdog(struct net_device *);	/* Transmission watchdog */ | 
|  | 737 | /* ------------------- CONFIGURATION CALLBACKS ------------------- */ | 
|  | 738 | static int | 
|  | 739 | wavelan_open(struct net_device *),		/* Open the device */ | 
|  | 740 | wavelan_close(struct net_device *);	/* Close the device */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 741 | static void | 
| Dominik Brodowski | cc3b486 | 2005-11-14 21:23:14 +0100 | [diff] [blame] | 742 | wavelan_detach(struct pcmcia_device *p_dev);	/* Destroy a removed device */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 743 |  | 
|  | 744 | /**************************** VARIABLES ****************************/ | 
|  | 745 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | /* | 
|  | 747 | * Parameters that can be set with 'insmod' | 
|  | 748 | * The exact syntax is 'insmod wavelan_cs.o <var>=<value>' | 
|  | 749 | */ | 
|  | 750 |  | 
|  | 751 | /* Shared memory speed, in ns */ | 
|  | 752 | static int	mem_speed = 0; | 
|  | 753 |  | 
|  | 754 | /* New module interface */ | 
|  | 755 | module_param(mem_speed, int, 0); | 
|  | 756 |  | 
|  | 757 | #ifdef WAVELAN_ROAMING		/* Conditional compile, see above in options */ | 
|  | 758 | /* Enable roaming mode ? No ! Please keep this to 0 */ | 
|  | 759 | static int	do_roaming = 0; | 
|  | 760 | module_param(do_roaming, bool, 0); | 
|  | 761 | #endif	/* WAVELAN_ROAMING */ | 
|  | 762 |  | 
|  | 763 | MODULE_LICENSE("GPL"); | 
|  | 764 |  | 
|  | 765 | #endif	/* WAVELAN_CS_P_H */ | 
|  | 766 |  |