Annotation of Gnu-Mach/linux/dev/drivers/net/wavelan.p.h, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.