00001 /* 00002 * WaveLAN ISA driver 00003 * 00004 * Jean II - HPLB '96 00005 * 00006 * Reorganisation and extension of the driver. 00007 * 00008 * This file contains all definitions and declarations necessary for the 00009 * WaveLAN ISA driver. This file is a private header, so it should 00010 * be included only in wavelan.c! 00011 */ 00012 00013 #ifndef WAVELAN_P_H 00014 #define WAVELAN_P_H 00015 00016 /************************** DOCUMENTATION ***************************/ 00017 /* 00018 * This driver provides a Linux interface to the WaveLAN ISA hardware. 00019 * The WaveLAN is a product of Lucent (http://www.wavelan.com/). 00020 * This division was formerly part of NCR and then AT&T. 00021 * WaveLANs are also distributed by DEC (RoamAbout DS) and Digital Ocean. 00022 * 00023 * To learn how to use this driver, read the NET3 HOWTO. 00024 * If you want to exploit the many other functionalities, read the comments 00025 * in the code. 00026 * 00027 * This driver is the result of the effort of many people (see below). 00028 */ 00029 00030 /* ------------------------ SPECIFIC NOTES ------------------------ */ 00031 /* 00032 * Web page 00033 * -------- 00034 * I try to maintain a web page with the Wireless LAN Howto at : 00035 * http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wavelan.html 00036 * 00037 * Debugging and options 00038 * --------------------- 00039 * You will find below a set of '#define" allowing a very fine control 00040 * on the driver behaviour and the debug messages printed. 00041 * The main options are : 00042 * o SET_PSA_CRC, to have your card correctly recognised by 00043 * an access point and the Point-to-Point diagnostic tool. 00044 * o USE_PSA_CONFIG, to read configuration from the PSA (EEprom) 00045 * (otherwise we always start afresh with some defaults) 00046 * 00047 * wavelan.o is too darned big 00048 * --------------------------- 00049 * That's true! There is a very simple way to reduce the driver 00050 * object by 33%! Comment out the following line: 00051 * #include <linux/wireless.h> 00052 * Other compile options can also reduce the size of it... 00053 * 00054 * MAC address and hardware detection: 00055 * ----------------------------------- 00056 * The detection code for the WaveLAN checks that the first three 00057 * octets of the MAC address fit the company code. This type of 00058 * detection works well for AT&T cards (because the AT&T code is 00059 * hardcoded in wavelan.h), but of course will fail for other 00060 * manufacturers. 00061 * 00062 * If you are sure that your card is derived from the WaveLAN, 00063 * here is the way to configure it: 00064 * 1) Get your MAC address 00065 * a) With your card utilities (wfreqsel, instconf, etc.) 00066 * b) With the driver: 00067 * o compile the kernel with DEBUG_CONFIG_INFO enabled 00068 * o Boot and look the card messages 00069 * 2) Set your MAC code (3 octets) in MAC_ADDRESSES[][3] (wavelan.h) 00070 * 3) Compile and verify 00071 * 4) Send me the MAC code. I will include it in the next version. 00072 * 00073 */ 00074 00075 /* --------------------- WIRELESS EXTENSIONS --------------------- */ 00076 /* 00077 * This driver is the first to support "wireless extensions". 00078 * This set of extensions provides a standard way to control the wireless 00079 * characteristics of the hardware. Applications such as mobile IP may 00080 * take advantage of it. 00081 * 00082 * You will need to enable the CONFIG_NET_RADIO define in the kernel 00083 * configuration to enable the wireless extensions (this is the one 00084 * giving access to the radio network device choice). 00085 * 00086 * It might also be a good idea as well to fetch the wireless tools to 00087 * configure the device and play a bit. 00088 */ 00089 00090 /* ---------------------------- FILES ---------------------------- */ 00091 /* 00092 * wavelan.c: actual code for the driver: C functions 00093 * 00094 * wavelan.p.h: private header: local types and variables for driver 00095 * 00096 * wavelan.h: description of the hardware interface and structs 00097 * 00098 * i82586.h: description of the Ethernet controller 00099 */ 00100 00101 /* --------------------------- HISTORY --------------------------- */ 00102 /* 00103 * This is based on information in the drivers' headers. It may not be 00104 * accurate, and I guarantee only my best effort. 00105 * 00106 * The history of the WaveLAN drivers is as complicated as the history of 00107 * the WaveLAN itself (NCR -> AT&T -> Lucent). 00108 * 00109 * It all started with Anders Klemets <klemets@paul.rutgers.edu> 00110 * writing a WaveLAN ISA driver for the Mach microkernel. Girish 00111 * Welling <welling@paul.rutgers.edu> had also worked on it. 00112 * Keith Moore modified this for the PCMCIA hardware. 00113 * 00114 * Robert Morris <rtm@das.harvard.edu> ported these two drivers to BSDI 00115 * and added specific PCMCIA support (there is currently no equivalent 00116 * of the PCMCIA package under BSD). 00117 * 00118 * Jim Binkley <jrb@cs.pdx.edu> ported both BSDI drivers to FreeBSD. 00119 * 00120 * Bruce Janson <bruce@cs.usyd.edu.au> ported the BSDI ISA driver to Linux. 00121 * 00122 * Anthony D. Joseph <adj@lcs.mit.edu> started to modify Bruce's driver 00123 * (with help of the BSDI PCMCIA driver) for PCMCIA. 00124 * Yunzhou Li <yunzhou@strat.iol.unh.edu> finished this work. 00125 * Joe Finney <joe@comp.lancs.ac.uk> patched the driver to start 00126 * 2.00 cards correctly (2.4 GHz with frequency selection). 00127 * David Hinds <dhinds@hyper.stanford.edu> integrated the whole in his 00128 * PCMCIA package (and bug corrections). 00129 * 00130 * I (Jean Tourrilhes - jt@hplb.hpl.hp.com) then started to make some 00131 * patches to the PCMCIA driver. Later, I added code in the ISA driver 00132 * for Wireless Extensions and full support of frequency selection 00133 * cards. Then, I did the same to the PCMCIA driver, and did some 00134 * reorganisation. Finally, I came back to the ISA driver to 00135 * upgrade it at the same level as the PCMCIA one and reorganise 00136 * the code. 00137 * Loeke Brederveld <lbrederv@wavelan.com> from Lucent has given me 00138 * much needed information on the WaveLAN hardware. 00139 */ 00140 00141 /* The original copyrights and literature mention others' names and 00142 * credits. I don't know what their part in this development was. 00143 */ 00144 00145 /* By the way, for the copyright and legal stuff: 00146 * almost everybody wrote code under the GNU or BSD license (or similar), 00147 * and want their original copyright to remain somewhere in the 00148 * code (for myself, I go with the GPL). 00149 * Nobody wants to take responsibility for anything, except the fame. 00150 */ 00151 00152 /* --------------------------- CREDITS --------------------------- */ 00153 /* 00154 * This software was developed as a component of the 00155 * Linux operating system. 00156 * It is based on other device drivers and information 00157 * either written or supplied by: 00158 * Ajay Bakre <bakre@paul.rutgers.edu>, 00159 * Donald Becker <becker@cesdis.gsfc.nasa.gov>, 00160 * Loeke Brederveld <Loeke.Brederveld@Utrecht.NCR.com>, 00161 * Brent Elphick <belphick@uwaterloo.ca>, 00162 * Anders Klemets <klemets@it.kth.se>, 00163 * Vladimir V. Kolpakov <w@stier.koenig.ru>, 00164 * Marc Meertens <Marc.Meertens@Utrecht.NCR.com>, 00165 * Pauline Middelink <middelin@polyware.iaf.nl>, 00166 * Robert Morris <rtm@das.harvard.edu>, 00167 * Jean Tourrilhes <jt@hpl.hp.com>, 00168 * Girish Welling <welling@paul.rutgers.edu>, 00169 * Clark Woodworth <clark@hiway1.exit109.com> 00170 * Yongguang Zhang <ygz@isl.hrl.hac.com> 00171 * 00172 * Thanks go also to: 00173 * James Ashton <jaa101@syseng.anu.edu.au>, 00174 * Alan Cox <iialan@iiit.swan.ac.uk>, 00175 * Allan Creighton <allanc@cs.usyd.edu.au>, 00176 * Matthew Geier <matthew@cs.usyd.edu.au>, 00177 * Remo di Giovanni <remo@cs.usyd.edu.au>, 00178 * Eckhard Grah <grah@wrcs1.urz.uni-wuppertal.de>, 00179 * Vipul Gupta <vgupta@cs.binghamton.edu>, 00180 * Mark Hagan <mhagan@wtcpost.daytonoh.NCR.COM>, 00181 * Tim Nicholson <tim@cs.usyd.edu.au>, 00182 * Ian Parkin <ian@cs.usyd.edu.au>, 00183 * John Rosenberg <johnr@cs.usyd.edu.au>, 00184 * George Rossi <george@phm.gov.au>, 00185 * Arthur Scott <arthur@cs.usyd.edu.au>, 00186 * Stanislav Sinyagin <stas@isf.ru> 00187 * and Peter Storey for their assistance and advice. 00188 * 00189 * Additional Credits: 00190 * 00191 * My development has been done under Linux 2.0.x (Debian 1.1) with 00192 * an HP Vectra XP/60. 00193 * 00194 */ 00195 00196 /* ------------------------- IMPROVEMENTS ------------------------- */ 00197 /* 00198 * I proudly present: 00199 * 00200 * Changes made in first pre-release: 00201 * ---------------------------------- 00202 * - reorganisation of the code, function name change 00203 * - creation of private header (wavelan.p.h) 00204 * - reorganised debug messages 00205 * - more comments, history, etc. 00206 * - mmc_init: configure the PSA if not done 00207 * - mmc_init: correct default value of level threshold for PCMCIA 00208 * - mmc_init: 2.00 detection better code for 2.00 initialization 00209 * - better info at startup 00210 * - IRQ setting (note: this setting is permanent) 00211 * - watchdog: change strategy (and solve module removal problems) 00212 * - add wireless extensions (ioctl and get_wireless_stats) 00213 * get/set nwid/frequency on fly, info for /proc/net/wireless 00214 * - more wireless extensions: SETSPY and GETSPY 00215 * - make wireless extensions optional 00216 * - private ioctl to set/get quality and level threshold, histogram 00217 * - remove /proc/net/wavelan 00218 * - suppress useless stuff from lp (net_local) 00219 * - kernel 2.1 support (copy_to/from_user instead of memcpy_to/fromfs) 00220 * - add message level (debug stuff in /var/adm/debug and errors not 00221 * displayed at console and still in /var/adm/messages) 00222 * - multi device support 00223 * - start fixing the probe (init code) 00224 * - more inlines 00225 * - man page 00226 * - many other minor details and cleanups 00227 * 00228 * Changes made in second pre-release: 00229 * ----------------------------------- 00230 * - clean up init code (probe and module init) 00231 * - better multiple device support (module) 00232 * - name assignment (module) 00233 * 00234 * Changes made in third pre-release: 00235 * ---------------------------------- 00236 * - be more conservative on timers 00237 * - preliminary support for multicast (I still lack some details) 00238 * 00239 * Changes made in fourth pre-release: 00240 * ----------------------------------- 00241 * - multicast (revisited and finished) 00242 * - avoid reset in set_multicast_list (a really big hack) 00243 * if somebody could apply this code for other i82586 based drivers 00244 * - share onboard memory 75% RU and 25% CU (instead of 50/50) 00245 * 00246 * Changes made for release in 2.1.15: 00247 * ----------------------------------- 00248 * - change the detection code for multi manufacturer code support 00249 * 00250 * Changes made for release in 2.1.17: 00251 * ----------------------------------- 00252 * - update to wireless extensions changes 00253 * - silly bug in card initial configuration (psa_conf_status) 00254 * 00255 * Changes made for release in 2.1.27 & 2.0.30: 00256 * -------------------------------------------- 00257 * - small bug in debug code (probably not the last one...) 00258 * - remove extern keyword for wavelan_probe() 00259 * - level threshold is now a standard wireless extension (version 4 !) 00260 * - modules parameters types (new module interface) 00261 * 00262 * Changes made for release in 2.1.36: 00263 * ----------------------------------- 00264 * - byte count stats (courtesy of David Hinds) 00265 * - remove dev_tint stuff (courtesy of David Hinds) 00266 * - encryption setting from Brent Elphick (thanks a lot!) 00267 * - 'ioaddr' to 'u_long' for the Alpha (thanks to Stanislav Sinyagin) 00268 * 00269 * Other changes (not by me) : 00270 * ------------------------- 00271 * - Spelling and gramar "rectification". 00272 * 00273 * Changes made for release in 2.0.37 & 2.2.2 : 00274 * ------------------------------------------ 00275 * - Correct status in /proc/net/wireless 00276 * - Set PSA CRC to make PtP diagnostic tool happy (Bob Gray) 00277 * - Module init code don't fail if we found at least one card in 00278 * the address list (Karlis Peisenieks) 00279 * - Missing parenthesis (Christopher Peterson) 00280 * - Correct i82586 configuration parameters 00281 * - Encryption initialisation bug (Robert McCormack) 00282 * - New mac addresses detected in the probe 00283 * - Increase watchdog for busy environments 00284 * 00285 * Changes made for release in 2.0.38 & 2.2.7 : 00286 * ------------------------------------------ 00287 * - Correct the reception logic to better report errors and avoid 00288 * sending bogus packet up the stack 00289 * - Delay RU config to avoid corrupting first received packet 00290 * - Change config completion code (to actually check something) 00291 * - Avoid reading out of bound in skbuf to transmit 00292 * - Rectify a lot of (useless) debugging code 00293 * - Change the way to `#ifdef SET_PSA_CRC' 00294 * 00295 * Changes made for release in 2.2.11 & 2.3.13 : 00296 * ------------------------------------------- 00297 * - Change e-mail and web page addresses 00298 * - Watchdog timer is now correctly expressed in HZ, not in jiffies 00299 * - Add channel number to the list of frequencies in range 00300 * - Add the (short) list of bit-rates in range 00301 * - Developp a new sensitivity... (sens.value & sens.fixed) 00302 * 00303 * Changes made for release in 2.2.14 & 2.3.23 : 00304 * ------------------------------------------- 00305 * - Fix check for root permission (break instead of exit) 00306 * - New nwid & encoding setting (Wireless Extension 9) 00307 * 00308 * Wishes & dreams: 00309 * ---------------- 00310 * - roaming (see Pcmcia driver) 00311 */ 00312 00313 /***************************** INCLUDES *****************************/ 00314 00315 #include <linux/module.h> 00316 00317 #include <linux/kernel.h> 00318 #include <linux/sched.h> 00319 #include <linux/types.h> 00320 #include <linux/fcntl.h> 00321 #include <linux/interrupt.h> 00322 #include <linux/stat.h> 00323 #include <linux/ptrace.h> 00324 #include <linux/ioport.h> 00325 #include <linux/in.h> 00326 #include <linux/string.h> 00327 #include <linux/delay.h> 00328 #include <asm/system.h> 00329 #include <asm/bitops.h> 00330 #include <asm/io.h> 00331 #include <asm/dma.h> 00332 #include <asm/uaccess.h> 00333 #include <linux/errno.h> 00334 #include <linux/netdevice.h> 00335 #include <linux/etherdevice.h> 00336 #include <linux/skbuff.h> 00337 #include <linux/malloc.h> 00338 #include <linux/timer.h> 00339 #include <linux/init.h> 00340 00341 #include <linux/wireless.h> /* Wireless extensions */ 00342 00343 /* WaveLAN declarations */ 00344 #include "i82586.h" 00345 #include "wavelan.h" 00346 00347 /************************** DRIVER OPTIONS **************************/ 00348 /* 00349 * `#define' or `#undef' the following constant to change the behaviour 00350 * of the driver... 00351 */ 00352 #undef SET_PSA_CRC /* Calculate and set the CRC on PSA (slower) */ 00353 #define USE_PSA_CONFIG /* Use info from the PSA. */ 00354 #undef STRUCT_CHECK /* Verify padding of structures. */ 00355 #undef EEPROM_IS_PROTECTED /* doesn't seem to be necessary */ 00356 #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical). */ 00357 #undef SET_MAC_ADDRESS /* Experimental */ 00358 00359 #ifdef WIRELESS_EXT /* If wireless extensions exist in the kernel */ 00360 /* Warning: this stuff will slow down the driver. */ 00361 #define WIRELESS_SPY /* Enable spying addresses. */ 00362 #undef HISTOGRAM /* Enable histogram of signal level. */ 00363 #endif 00364 00365 /****************************** DEBUG ******************************/ 00366 00367 #undef DEBUG_MODULE_TRACE /* module insertion/removal */ 00368 #undef DEBUG_CALLBACK_TRACE /* calls made by Linux */ 00369 #undef DEBUG_INTERRUPT_TRACE /* calls to handler */ 00370 #undef DEBUG_INTERRUPT_INFO /* type of interrupt and so on */ 00371 #define DEBUG_INTERRUPT_ERROR /* problems */ 00372 #undef DEBUG_CONFIG_TRACE /* Trace the config functions. */ 00373 #undef DEBUG_CONFIG_INFO /* what's going on */ 00374 #define DEBUG_CONFIG_ERROR /* errors on configuration */ 00375 #undef DEBUG_TX_TRACE /* transmission calls */ 00376 #undef DEBUG_TX_INFO /* header of the transmitted packet */ 00377 #undef DEBUG_TX_FAIL /* Normal failure conditions */ 00378 #define DEBUG_TX_ERROR /* Unexpected conditions */ 00379 #undef DEBUG_RX_TRACE /* transmission calls */ 00380 #undef DEBUG_RX_INFO /* header of the received packet */ 00381 #undef DEBUG_RX_FAIL /* Normal failure conditions */ 00382 #define DEBUG_RX_ERROR /* Unexpected conditions */ 00383 #undef DEBUG_PACKET_DUMP 32 /* Dump packet on the screen. */ 00384 #undef DEBUG_IOCTL_TRACE /* misc. call by Linux */ 00385 #undef DEBUG_IOCTL_INFO /* various debugging info */ 00386 #define DEBUG_IOCTL_ERROR /* what's going wrong */ 00387 #define DEBUG_BASIC_SHOW /* Show basic startup info. */ 00388 #undef DEBUG_VERSION_SHOW /* Print version info. */ 00389 #undef DEBUG_PSA_SHOW /* Dump PSA to screen. */ 00390 #undef DEBUG_MMC_SHOW /* Dump mmc to screen. */ 00391 #undef DEBUG_SHOW_UNUSED /* Show unused fields too. */ 00392 #undef DEBUG_I82586_SHOW /* Show i82586 status. */ 00393 #undef DEBUG_DEVICE_SHOW /* Show device parameters. */ 00394 00395 /************************ CONSTANTS & MACROS ************************/ 00396 00397 #ifdef DEBUG_VERSION_SHOW 00398 static const char *version = "wavelan.c : v21 (wireless extensions) 16/10/99\n"; 00399 #endif 00400 00401 /* Watchdog temporisation */ 00402 #define WATCHDOG_JIFFIES (256*HZ/100) 00403 00404 /* Macro to get the number of elements in an array */ 00405 #define NELS(a) (sizeof(a) / sizeof(a[0])) 00406 00407 /* ------------------------ PRIVATE IOCTL ------------------------ */ 00408 00409 #define SIOCSIPQTHR SIOCDEVPRIVATE /* Set quality threshold */ 00410 #define SIOCGIPQTHR SIOCDEVPRIVATE + 1 /* Get quality threshold */ 00411 #define SIOCSIPLTHR SIOCDEVPRIVATE + 2 /* Set level threshold */ 00412 #define SIOCGIPLTHR SIOCDEVPRIVATE + 3 /* Get level threshold */ 00413 00414 #define SIOCSIPHISTO SIOCDEVPRIVATE + 6 /* Set histogram ranges */ 00415 #define SIOCGIPHISTO SIOCDEVPRIVATE + 7 /* Get histogram values */ 00416 00417 /****************************** TYPES ******************************/ 00418 00419 /* Shortcuts */ 00420 typedef struct device device; 00421 typedef struct net_device_stats en_stats; 00422 typedef struct iw_statistics iw_stats; 00423 typedef struct iw_quality iw_qual; 00424 typedef struct iw_freq iw_freq; 00425 typedef struct net_local net_local; 00426 typedef struct timer_list timer_list; 00427 00428 /* Basic types */ 00429 typedef u_char mac_addr[WAVELAN_ADDR_SIZE]; /* Hardware address */ 00430 00431 /* 00432 * Static specific data for the interface. 00433 * 00434 * For each network interface, Linux keeps data in two structures: "device" 00435 * keeps the generic data (same format for everybody) and "net_local" keeps 00436 * additional specific data. 00437 * Note that some of this specific data is in fact generic (en_stats, for 00438 * example). 00439 */ 00440 struct net_local 00441 { 00442 net_local * next; /* linked list of the devices */ 00443 device * dev; /* reverse link */ 00444 en_stats stats; /* Ethernet interface statistics */ 00445 int nresets; /* number of hardware resets */ 00446 u_char reconfig_82586; /* We need to reconfigure the controller. */ 00447 u_char promiscuous; /* promiscuous mode */ 00448 int mc_count; /* number of multicast addresses */ 00449 timer_list watchdog; /* to avoid blocking state */ 00450 u_short hacr; /* current host interface state */ 00451 00452 int tx_n_in_use; 00453 u_short rx_head; 00454 u_short rx_last; 00455 u_short tx_first_free; 00456 u_short tx_first_in_use; 00457 00458 #ifdef WIRELESS_EXT 00459 iw_stats wstats; /* Wireless-specific statistics */ 00460 #endif 00461 00462 #ifdef WIRELESS_SPY 00463 int spy_number; /* number of addresses to spy */ 00464 mac_addr spy_address[IW_MAX_SPY]; /* the addresses to spy */ 00465 iw_qual spy_stat[IW_MAX_SPY]; /* statistics gathered */ 00466 #endif /* WIRELESS_SPY */ 00467 00468 #ifdef HISTOGRAM 00469 int his_number; /* number of intervals */ 00470 u_char his_range[16]; /* boundaries of interval ]n-1; n] */ 00471 u_long his_sum[16]; /* sum in interval */ 00472 #endif /* HISTOGRAM */ 00473 }; 00474 00475 /**************************** PROTOTYPES ****************************/ 00476 00477 /* ----------------------- MISC. SUBROUTINES ------------------------ */ 00478 static inline unsigned long /* flags */ 00479 wv_splhi(void); /* Disable interrupts */ 00480 static inline void 00481 wv_splx(unsigned long); /* Enable interrupts: flags */ 00482 static u_char 00483 wv_irq_to_psa(int); 00484 static int 00485 wv_psa_to_irq(u_char); 00486 /* ------------------- HOST ADAPTER SUBROUTINES ------------------- */ 00487 static inline u_short /* data */ 00488 hasr_read(u_long); /* Read the host interface: base address */ 00489 static inline void 00490 hacr_write(u_long, /* Write to host interface: base address */ 00491 u_short), /* data */ 00492 hacr_write_slow(u_long, 00493 u_short), 00494 set_chan_attn(u_long, /* ioaddr */ 00495 u_short), /* hacr */ 00496 wv_hacr_reset(u_long), /* ioaddr */ 00497 wv_16_off(u_long, /* ioaddr */ 00498 u_short), /* hacr */ 00499 wv_16_on(u_long, /* ioaddr */ 00500 u_short), /* hacr */ 00501 wv_ints_off(device *), 00502 wv_ints_on(device *); 00503 /* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */ 00504 static void 00505 psa_read(u_long, /* Read the Parameter Storage Area. */ 00506 u_short, /* hacr */ 00507 int, /* offset in PSA */ 00508 u_char *, /* buffer to fill */ 00509 int), /* size to read */ 00510 psa_write(u_long, /* Write to the PSA. */ 00511 u_short, /* hacr */ 00512 int, /* offset in PSA */ 00513 u_char *, /* buffer in memory */ 00514 int); /* length of buffer */ 00515 static inline void 00516 mmc_out(u_long, /* Write 1 byte to the Modem Manag Control. */ 00517 u_short, 00518 u_char), 00519 mmc_write(u_long, /* Write n bytes to the MMC. */ 00520 u_char, 00521 u_char *, 00522 int); 00523 static inline u_char /* Read 1 byte from the MMC. */ 00524 mmc_in(u_long, 00525 u_short); 00526 static inline void 00527 mmc_read(u_long, /* Read n bytes from the MMC. */ 00528 u_char, 00529 u_char *, 00530 int), 00531 fee_wait(u_long, /* Wait for frequency EEPROM: base address */ 00532 int, /* base delay to wait for */ 00533 int); /* time to wait */ 00534 static void 00535 fee_read(u_long, /* Read the frequency EEPROM: base address */ 00536 u_short, /* destination offset */ 00537 u_short *, /* data buffer */ 00538 int); /* number of registers */ 00539 /* ---------------------- I82586 SUBROUTINES ----------------------- */ 00540 static /*inline*/ void 00541 obram_read(u_long, /* ioaddr */ 00542 u_short, /* o */ 00543 u_char *, /* b */ 00544 int); /* n */ 00545 static inline void 00546 obram_write(u_long, /* ioaddr */ 00547 u_short, /* o */ 00548 u_char *, /* b */ 00549 int); /* n */ 00550 static void 00551 wv_ack(device *); 00552 static inline int 00553 wv_synchronous_cmd(device *, 00554 const char *), 00555 wv_config_complete(device *, 00556 u_long, 00557 net_local *); 00558 static int 00559 wv_complete(device *, 00560 u_long, 00561 net_local *); 00562 static inline void 00563 wv_82586_reconfig(device *); 00564 /* ------------------- DEBUG & INFO SUBROUTINES ------------------- */ 00565 #ifdef DEBUG_I82586_SHOW 00566 static void 00567 wv_scb_show(unsigned short); 00568 #endif 00569 static inline void 00570 wv_init_info(device *); /* display startup info */ 00571 /* ------------------- IOCTL, STATS & RECONFIG ------------------- */ 00572 static en_stats * 00573 wavelan_get_stats(device *); /* Give stats /proc/net/dev */ 00574 static void 00575 wavelan_set_multicast_list(device *); 00576 /* ----------------------- PACKET RECEPTION ----------------------- */ 00577 static inline void 00578 wv_packet_read(device *, /* Read a packet from a frame. */ 00579 u_short, 00580 int), 00581 wv_receive(device *); /* Read all packets waiting. */ 00582 /* --------------------- PACKET TRANSMISSION --------------------- */ 00583 static inline void 00584 wv_packet_write(device *, /* Write a packet to the Tx buffer. */ 00585 void *, 00586 short); 00587 static int 00588 wavelan_packet_xmit(struct sk_buff *, /* Send a packet. */ 00589 device *); 00590 /* -------------------- HARDWARE CONFIGURATION -------------------- */ 00591 static inline int 00592 wv_mmc_init(device *), /* Initialize the modem. */ 00593 wv_ru_start(device *), /* Start the i82586 receiver unit. */ 00594 wv_cu_start(device *), /* Start the i82586 command unit. */ 00595 wv_82586_start(device *); /* Start the i82586. */ 00596 static void 00597 wv_82586_config(device *); /* Configure the i82586. */ 00598 static inline void 00599 wv_82586_stop(device *); 00600 static int 00601 wv_hw_reset(device *), /* Reset the WaveLAN hardware. */ 00602 wv_check_ioaddr(u_long, /* ioaddr */ 00603 u_char *); /* mac address (read) */ 00604 /* ---------------------- INTERRUPT HANDLING ---------------------- */ 00605 static void 00606 wavelan_interrupt(int, /* interrupt handler */ 00607 void *, 00608 struct pt_regs *); 00609 static void 00610 wavelan_watchdog(u_long); /* transmission watchdog */ 00611 /* ------------------- CONFIGURATION CALLBACKS ------------------- */ 00612 static int 00613 wavelan_open(device *), /* Open the device. */ 00614 wavelan_close(device *), /* Close the device. */ 00615 wavelan_config(device *); /* Configure one device. */ 00616 extern int 00617 wavelan_probe(device *); /* See Space.c. */ 00618 00619 /**************************** VARIABLES ****************************/ 00620 00621 /* 00622 * This is the root of the linked list of WaveLAN drivers 00623 * It is use to verify that we don't reuse the same base address 00624 * for two different drivers and to clean up when removing the module. 00625 */ 00626 static net_local * wavelan_list = (net_local *) NULL; 00627 00628 /* 00629 * This table is used to translate the PSA value to IRQ number 00630 * and vice versa. 00631 */ 00632 static u_char irqvals[] = 00633 { 00634 0, 0, 0, 0x01, 00635 0x02, 0x04, 0, 0x08, 00636 0, 0, 0x10, 0x20, 00637 0x40, 0, 0, 0x80, 00638 }; 00639 00640 /* 00641 * Table of the available I/O addresses (base addresses) for WaveLAN 00642 */ 00643 static unsigned short iobase[] = 00644 { 00645 #if 0 00646 /* Leave out 0x3C0 for now -- seems to clash with some video 00647 * controllers. 00648 * Leave out the others too -- we will always use 0x390 and leave 00649 * 0x300 for the Ethernet device. 00650 * Jean II: 0x3E0 is fine as well. 00651 */ 00652 0x300, 0x390, 0x3E0, 0x3C0 00653 #endif /* 0 */ 00654 0x390, 0x3E0 00655 }; 00656 00657 #ifdef MODULE 00658 /* Parameters set by insmod */ 00659 static int io[4] = { 0, 0, 0, 0 }; 00660 static int irq[4] = { 0, 0, 0, 0 }; 00661 static char name[4][IFNAMSIZ] = { "", "", "", "" }; 00662 MODULE_PARM(io, "1-4i"); 00663 MODULE_PARM(irq, "1-4i"); 00664 MODULE_PARM(name, "1-4c" __MODULE_STRING(IFNAMSIZ)); 00665 #endif /* MODULE */ 00666 00667 #endif /* WAVELAN_P_H */