6 * Reorganisation and extension of the driver.
7 * Original copyright follows (also see the end of this file).
8 * See wavelan.p.h for details.
12 * AT&T GIS (nee NCR) WaveLAN card:
13 * An Ethernet-like radio transceiver
14 * controlled by an Intel 82586 coprocessor.
17 #include "wavelan.p.h" /* Private header */
19 /************************* MISC SUBROUTINES **************************/
21 * Subroutines which won't fit in one of the following category
22 * (WaveLAN modem or i82586)
25 /*------------------------------------------------------------------*/
27 * Translate irq number to PSA irq parameter
29 static u8 wv_irq_to_psa(int irq)
31 if (irq < 0 || irq >= ARRAY_SIZE(irqvals))
37 /*------------------------------------------------------------------*/
39 * Translate PSA irq parameter to irq number
41 static int __init wv_psa_to_irq(u8 irqval)
45 for (irq = 0; irq < ARRAY_SIZE(irqvals); irq++)
46 if (irqvals[irq] == irqval)
52 /********************* HOST ADAPTER SUBROUTINES *********************/
54 * Useful subroutines to manage the WaveLAN ISA interface
56 * One major difference with the PCMCIA hardware (except the port mapping)
57 * is that we have to keep the state of the Host Control Register
58 * because of the interrupt enable & bus size flags.
61 /*------------------------------------------------------------------*/
63 * Read from card's Host Adaptor Status Register.
65 static inline u16 hasr_read(unsigned long ioaddr)
67 return (inw(HASR(ioaddr)));
70 /*------------------------------------------------------------------*/
72 * Write to card's Host Adapter Command Register.
74 static inline void hacr_write(unsigned long ioaddr, u16 hacr)
76 outw(hacr, HACR(ioaddr));
79 /*------------------------------------------------------------------*/
81 * Write to card's Host Adapter Command Register. Include a delay for
82 * those times when it is needed.
84 static void hacr_write_slow(unsigned long ioaddr, u16 hacr)
86 hacr_write(ioaddr, hacr);
87 /* delay might only be needed sometimes */
89 } /* hacr_write_slow */
91 /*------------------------------------------------------------------*/
93 * Set the channel attention bit.
95 static inline void set_chan_attn(unsigned long ioaddr, u16 hacr)
97 hacr_write(ioaddr, hacr | HACR_CA);
100 /*------------------------------------------------------------------*/
102 * Reset, and then set host adaptor into default mode.
104 static inline void wv_hacr_reset(unsigned long ioaddr)
106 hacr_write_slow(ioaddr, HACR_RESET);
107 hacr_write(ioaddr, HACR_DEFAULT);
108 } /* wv_hacr_reset */
110 /*------------------------------------------------------------------*/
112 * Set the I/O transfer over the ISA bus to 8-bit mode
114 static inline void wv_16_off(unsigned long ioaddr, u16 hacr)
116 hacr &= ~HACR_16BITS;
117 hacr_write(ioaddr, hacr);
120 /*------------------------------------------------------------------*/
122 * Set the I/O transfer over the ISA bus to 8-bit mode
124 static inline void wv_16_on(unsigned long ioaddr, u16 hacr)
127 hacr_write(ioaddr, hacr);
130 /*------------------------------------------------------------------*/
132 * Disable interrupts on the WaveLAN hardware.
133 * (called by wv_82586_stop())
135 static inline void wv_ints_off(struct net_device * dev)
137 net_local *lp = (net_local *) dev->priv;
138 unsigned long ioaddr = dev->base_addr;
140 lp->hacr &= ~HACR_INTRON;
141 hacr_write(ioaddr, lp->hacr);
144 /*------------------------------------------------------------------*/
146 * Enable interrupts on the WaveLAN hardware.
147 * (called by wv_hw_reset())
149 static inline void wv_ints_on(struct net_device * dev)
151 net_local *lp = (net_local *) dev->priv;
152 unsigned long ioaddr = dev->base_addr;
154 lp->hacr |= HACR_INTRON;
155 hacr_write(ioaddr, lp->hacr);
158 /******************* MODEM MANAGEMENT SUBROUTINES *******************/
160 * Useful subroutines to manage the modem of the WaveLAN
163 /*------------------------------------------------------------------*/
165 * Read the Parameter Storage Area from the WaveLAN card's memory
168 * Read bytes from the PSA.
170 static void psa_read(unsigned long ioaddr, u16 hacr, int o, /* offset in PSA */
171 u8 * b, /* buffer to fill */
174 wv_16_off(ioaddr, hacr);
177 outw(o, PIOR2(ioaddr));
179 *b++ = inb(PIOP2(ioaddr));
182 wv_16_on(ioaddr, hacr);
185 /*------------------------------------------------------------------*/
187 * Write the Parameter Storage Area to the WaveLAN card's memory.
189 static void psa_write(unsigned long ioaddr, u16 hacr, int o, /* Offset in PSA */
190 u8 * b, /* Buffer in memory */
192 { /* Length of buffer */
195 wv_16_off(ioaddr, hacr);
198 outw(o, PIOR2(ioaddr));
201 outb(*b, PIOP2(ioaddr));
204 /* Wait for the memory to finish its write cycle */
206 while ((count++ < 100) &&
207 (hasr_read(ioaddr) & HASR_PSA_BUSY)) mdelay(1);
210 wv_16_on(ioaddr, hacr);
214 /*------------------------------------------------------------------*/
216 * Calculate the PSA CRC
217 * Thanks to Valster, Nico <NVALSTER@wcnd.nl.lucent.com> for the code
218 * NOTE: By specifying a length including the CRC position the
219 * returned value should be zero. (i.e. a correct checksum in the PSA)
221 * The Windows drivers don't use the CRC, but the AP and the PtP tool
224 static u16 psa_crc(u8 * psa, /* The PSA */
226 { /* Number of short for CRC */
227 int byte_cnt; /* Loop on the PSA */
228 u16 crc_bytes = 0; /* Data in the PSA */
229 int bit_cnt; /* Loop on the bits of the short */
231 for (byte_cnt = 0; byte_cnt < size; byte_cnt++) {
232 crc_bytes ^= psa[byte_cnt]; /* Its an xor */
234 for (bit_cnt = 1; bit_cnt < 9; bit_cnt++) {
235 if (crc_bytes & 0x0001)
236 crc_bytes = (crc_bytes >> 1) ^ 0xA001;
244 #endif /* SET_PSA_CRC */
246 /*------------------------------------------------------------------*/
248 * update the checksum field in the Wavelan's PSA
250 static void update_psa_checksum(struct net_device * dev, unsigned long ioaddr, u16 hacr)
256 /* read the parameter storage area */
257 psa_read(ioaddr, hacr, 0, (unsigned char *) &psa, sizeof(psa));
259 /* update the checksum */
260 crc = psa_crc((unsigned char *) &psa,
261 sizeof(psa) - sizeof(psa.psa_crc[0]) -
262 sizeof(psa.psa_crc[1])
263 - sizeof(psa.psa_crc_status));
265 psa.psa_crc[0] = crc & 0xFF;
266 psa.psa_crc[1] = (crc & 0xFF00) >> 8;
269 psa_write(ioaddr, hacr, (char *) &psa.psa_crc - (char *) &psa,
270 (unsigned char *) &psa.psa_crc, 2);
272 #ifdef DEBUG_IOCTL_INFO
273 printk(KERN_DEBUG "%s: update_psa_checksum(): crc = 0x%02x%02x\n",
274 dev->name, psa.psa_crc[0], psa.psa_crc[1]);
276 /* Check again (luxury !) */
277 crc = psa_crc((unsigned char *) &psa,
278 sizeof(psa) - sizeof(psa.psa_crc_status));
282 "%s: update_psa_checksum(): CRC does not agree with PSA data (even after recalculating)\n",
284 #endif /* DEBUG_IOCTL_INFO */
285 #endif /* SET_PSA_CRC */
286 } /* update_psa_checksum */
288 /*------------------------------------------------------------------*/
290 * Write 1 byte to the MMC.
292 static void mmc_out(unsigned long ioaddr, u16 o, u8 d)
296 /* Wait for MMC to go idle */
297 while ((count++ < 100) && (inw(HASR(ioaddr)) & HASR_MMC_BUSY))
300 outw((u16) (((u16) d << 8) | (o << 1) | 1), MMCR(ioaddr));
303 /*------------------------------------------------------------------*/
305 * Routine to write bytes to the Modem Management Controller.
306 * We start at the end because it is the way it should be!
308 static void mmc_write(unsigned long ioaddr, u8 o, u8 * b, int n)
314 mmc_out(ioaddr, --o, *(--b));
317 /*------------------------------------------------------------------*/
319 * Read a byte from the MMC.
320 * Optimised version for 1 byte, avoid using memory.
322 static u8 mmc_in(unsigned long ioaddr, u16 o)
326 while ((count++ < 100) && (inw(HASR(ioaddr)) & HASR_MMC_BUSY))
328 outw(o << 1, MMCR(ioaddr));
330 while ((count++ < 100) && (inw(HASR(ioaddr)) & HASR_MMC_BUSY))
332 return (u8) (inw(MMCR(ioaddr)) >> 8);
335 /*------------------------------------------------------------------*/
337 * Routine to read bytes from the Modem Management Controller.
338 * The implementation is complicated by a lack of address lines,
339 * which prevents decoding of the low-order bit.
340 * (code has just been moved in the above function)
341 * We start at the end because it is the way it should be!
343 static inline void mmc_read(unsigned long ioaddr, u8 o, u8 * b, int n)
349 *(--b) = mmc_in(ioaddr, --o);
352 /*------------------------------------------------------------------*/
354 * Get the type of encryption available.
356 static inline int mmc_encr(unsigned long ioaddr)
357 { /* I/O port of the card */
360 temp = mmc_in(ioaddr, mmroff(0, mmr_des_avail));
361 if ((temp != MMR_DES_AVAIL_DES) && (temp != MMR_DES_AVAIL_AES))
367 /*------------------------------------------------------------------*/
369 * Wait for the frequency EEPROM to complete a command.
370 * I hope this one will be optimally inlined.
372 static inline void fee_wait(unsigned long ioaddr, /* I/O port of the card */
373 int delay, /* Base delay to wait for */
375 { /* Number of time to wait */
376 int count = 0; /* Wait only a limited time */
378 while ((count++ < number) &&
379 (mmc_in(ioaddr, mmroff(0, mmr_fee_status)) &
380 MMR_FEE_STATUS_BUSY)) udelay(delay);
383 /*------------------------------------------------------------------*/
385 * Read bytes from the Frequency EEPROM (frequency select cards).
387 static void fee_read(unsigned long ioaddr, /* I/O port of the card */
388 u16 o, /* destination offset */
389 u16 * b, /* data buffer */
391 { /* number of registers */
392 b += n; /* Position at the end of the area */
394 /* Write the address */
395 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), o + n - 1);
397 /* Loop on all buffer */
399 /* Write the read command */
400 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl),
403 /* Wait until EEPROM is ready (should be quick). */
404 fee_wait(ioaddr, 10, 100);
406 /* Read the value. */
407 *--b = ((mmc_in(ioaddr, mmroff(0, mmr_fee_data_h)) << 8) |
408 mmc_in(ioaddr, mmroff(0, mmr_fee_data_l)));
413 /*------------------------------------------------------------------*/
415 * Write bytes from the Frequency EEPROM (frequency select cards).
416 * This is a bit complicated, because the frequency EEPROM has to
417 * be unprotected and the write enabled.
420 static void fee_write(unsigned long ioaddr, /* I/O port of the card */
421 u16 o, /* destination offset */
422 u16 * b, /* data buffer */
424 { /* number of registers */
425 b += n; /* Position at the end of the area. */
427 #ifdef EEPROM_IS_PROTECTED /* disabled */
428 #ifdef DOESNT_SEEM_TO_WORK /* disabled */
429 /* Ask to read the protected register */
430 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl), MMW_FEE_CTRL_PRREAD);
432 fee_wait(ioaddr, 10, 100);
434 /* Read the protected register. */
435 printk("Protected 2: %02X-%02X\n",
436 mmc_in(ioaddr, mmroff(0, mmr_fee_data_h)),
437 mmc_in(ioaddr, mmroff(0, mmr_fee_data_l)));
438 #endif /* DOESNT_SEEM_TO_WORK */
440 /* Enable protected register. */
441 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), MMW_FEE_ADDR_EN);
442 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl), MMW_FEE_CTRL_PREN);
444 fee_wait(ioaddr, 10, 100);
446 /* Unprotect area. */
447 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), o + n);
448 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl), MMW_FEE_CTRL_PRWRITE);
449 #ifdef DOESNT_SEEM_TO_WORK /* disabled */
451 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl), MMW_FEE_CTRL_PRCLEAR);
452 #endif /* DOESNT_SEEM_TO_WORK */
454 fee_wait(ioaddr, 10, 100);
455 #endif /* EEPROM_IS_PROTECTED */
458 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), MMW_FEE_ADDR_EN);
459 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl), MMW_FEE_CTRL_WREN);
461 fee_wait(ioaddr, 10, 100);
463 /* Write the EEPROM address. */
464 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), o + n - 1);
466 /* Loop on all buffer */
468 /* Write the value. */
469 mmc_out(ioaddr, mmwoff(0, mmw_fee_data_h), (*--b) >> 8);
470 mmc_out(ioaddr, mmwoff(0, mmw_fee_data_l), *b & 0xFF);
472 /* Write the write command. */
473 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl),
476 /* WaveLAN documentation says to wait at least 10 ms for EEBUSY = 0 */
478 fee_wait(ioaddr, 10, 100);
482 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), MMW_FEE_ADDR_DS);
483 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl), MMW_FEE_CTRL_WDS);
485 fee_wait(ioaddr, 10, 100);
487 #ifdef EEPROM_IS_PROTECTED /* disabled */
488 /* Reprotect EEPROM. */
489 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), 0x00);
490 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl), MMW_FEE_CTRL_PRWRITE);
492 fee_wait(ioaddr, 10, 100);
493 #endif /* EEPROM_IS_PROTECTED */
496 /************************ I82586 SUBROUTINES *************************/
498 * Useful subroutines to manage the Ethernet controller
501 /*------------------------------------------------------------------*/
503 * Read bytes from the on-board RAM.
504 * Why does inlining this function make it fail?
506 static /*inline */ void obram_read(unsigned long ioaddr,
507 u16 o, u8 * b, int n)
509 outw(o, PIOR1(ioaddr));
510 insw(PIOP1(ioaddr), (unsigned short *) b, (n + 1) >> 1);
513 /*------------------------------------------------------------------*/
515 * Write bytes to the on-board RAM.
517 static inline void obram_write(unsigned long ioaddr, u16 o, u8 * b, int n)
519 outw(o, PIOR1(ioaddr));
520 outsw(PIOP1(ioaddr), (unsigned short *) b, (n + 1) >> 1);
523 /*------------------------------------------------------------------*/
525 * Acknowledge the reading of the status issued by the i82586.
527 static void wv_ack(struct net_device * dev)
529 net_local *lp = (net_local *) dev->priv;
530 unsigned long ioaddr = dev->base_addr;
534 obram_read(ioaddr, scboff(OFFSET_SCB, scb_status),
535 (unsigned char *) &scb_cs, sizeof(scb_cs));
536 scb_cs &= SCB_ST_INT;
541 obram_write(ioaddr, scboff(OFFSET_SCB, scb_command),
542 (unsigned char *) &scb_cs, sizeof(scb_cs));
544 set_chan_attn(ioaddr, lp->hacr);
546 for (i = 1000; i > 0; i--) {
547 obram_read(ioaddr, scboff(OFFSET_SCB, scb_command),
548 (unsigned char *) &scb_cs, sizeof(scb_cs));
556 #ifdef DEBUG_CONFIG_ERROR
559 "%s: wv_ack(): board not accepting command.\n",
564 /*------------------------------------------------------------------*/
566 * Set channel attention bit and busy wait until command has
567 * completed, then acknowledge completion of the command.
569 static int wv_synchronous_cmd(struct net_device * dev, const char *str)
571 net_local *lp = (net_local *) dev->priv;
572 unsigned long ioaddr = dev->base_addr;
577 scb_cmd = SCB_CMD_CUC & SCB_CMD_CUC_GO;
578 obram_write(ioaddr, scboff(OFFSET_SCB, scb_command),
579 (unsigned char *) &scb_cmd, sizeof(scb_cmd));
581 set_chan_attn(ioaddr, lp->hacr);
583 for (i = 1000; i > 0; i--) {
584 obram_read(ioaddr, OFFSET_CU, (unsigned char *) &cb,
586 if (cb.ac_status & AC_SFLD_C)
593 if (i <= 0 || !(cb.ac_status & AC_SFLD_OK)) {
594 #ifdef DEBUG_CONFIG_ERROR
595 printk(KERN_INFO "%s: %s failed; status = 0x%x\n",
596 dev->name, str, cb.ac_status);
598 #ifdef DEBUG_I82586_SHOW
610 /*------------------------------------------------------------------*/
612 * Configuration commands completion interrupt.
613 * Check if done, and if OK.
616 wv_config_complete(struct net_device * dev, unsigned long ioaddr, net_local * lp)
618 unsigned short mcs_addr;
619 unsigned short status;
622 #ifdef DEBUG_INTERRUPT_TRACE
623 printk(KERN_DEBUG "%s: ->wv_config_complete()\n", dev->name);
626 mcs_addr = lp->tx_first_in_use + sizeof(ac_tx_t) + sizeof(ac_nop_t)
627 + sizeof(tbd_t) + sizeof(ac_cfg_t) + sizeof(ac_ias_t);
629 /* Read the status of the last command (set mc list). */
630 obram_read(ioaddr, acoff(mcs_addr, ac_status),
631 (unsigned char *) &status, sizeof(status));
633 /* If not completed -> exit */
634 if ((status & AC_SFLD_C) == 0)
635 ret = 0; /* Not ready to be scrapped */
637 #ifdef DEBUG_CONFIG_ERROR
638 unsigned short cfg_addr;
639 unsigned short ias_addr;
641 /* Check mc_config command */
642 if ((status & AC_SFLD_OK) != AC_SFLD_OK)
644 "%s: wv_config_complete(): set_multicast_address failed; status = 0x%x\n",
647 /* check ia-config command */
648 ias_addr = mcs_addr - sizeof(ac_ias_t);
649 obram_read(ioaddr, acoff(ias_addr, ac_status),
650 (unsigned char *) &status, sizeof(status));
651 if ((status & AC_SFLD_OK) != AC_SFLD_OK)
653 "%s: wv_config_complete(): set_MAC_address failed; status = 0x%x\n",
656 /* Check config command. */
657 cfg_addr = ias_addr - sizeof(ac_cfg_t);
658 obram_read(ioaddr, acoff(cfg_addr, ac_status),
659 (unsigned char *) &status, sizeof(status));
660 if ((status & AC_SFLD_OK) != AC_SFLD_OK)
662 "%s: wv_config_complete(): configure failed; status = 0x%x\n",
664 #endif /* DEBUG_CONFIG_ERROR */
666 ret = 1; /* Ready to be scrapped */
669 #ifdef DEBUG_INTERRUPT_TRACE
670 printk(KERN_DEBUG "%s: <-wv_config_complete() - %d\n", dev->name,
676 /*------------------------------------------------------------------*/
678 * Command completion interrupt.
679 * Reclaim as many freed tx buffers as we can.
680 * (called in wavelan_interrupt()).
681 * Note : the spinlock is already grabbed for us.
683 static int wv_complete(struct net_device * dev, unsigned long ioaddr, net_local * lp)
687 #ifdef DEBUG_INTERRUPT_TRACE
688 printk(KERN_DEBUG "%s: ->wv_complete()\n", dev->name);
691 /* Loop on all the transmit buffers */
692 while (lp->tx_first_in_use != I82586NULL) {
693 unsigned short tx_status;
695 /* Read the first transmit buffer */
696 obram_read(ioaddr, acoff(lp->tx_first_in_use, ac_status),
697 (unsigned char *) &tx_status,
700 /* If not completed -> exit */
701 if ((tx_status & AC_SFLD_C) == 0)
704 /* Hack for reconfiguration */
705 if (tx_status == 0xFFFF)
706 if (!wv_config_complete(dev, ioaddr, lp))
707 break; /* Not completed */
709 /* We now remove this buffer */
714 if (lp->tx_n_in_use > 0)
715 printk("%c", "0123456789abcdefghijk"[lp->tx_n_in_use]);
718 /* Was it the last one? */
719 if (lp->tx_n_in_use <= 0)
720 lp->tx_first_in_use = I82586NULL;
722 /* Next one in the chain */
723 lp->tx_first_in_use += TXBLOCKZ;
724 if (lp->tx_first_in_use >=
726 NTXBLOCKS * TXBLOCKZ) lp->tx_first_in_use -=
727 NTXBLOCKS * TXBLOCKZ;
730 /* Hack for reconfiguration */
731 if (tx_status == 0xFFFF)
734 /* Now, check status of the finished command */
735 if (tx_status & AC_SFLD_OK) {
738 lp->stats.tx_packets++;
739 ncollisions = tx_status & AC_SFLD_MAXCOL;
740 lp->stats.collisions += ncollisions;
744 "%s: wv_complete(): tx completed after %d collisions.\n",
745 dev->name, ncollisions);
748 lp->stats.tx_errors++;
749 if (tx_status & AC_SFLD_S10) {
750 lp->stats.tx_carrier_errors++;
753 "%s: wv_complete(): tx error: no CS.\n",
757 if (tx_status & AC_SFLD_S9) {
758 lp->stats.tx_carrier_errors++;
761 "%s: wv_complete(): tx error: lost CTS.\n",
765 if (tx_status & AC_SFLD_S8) {
766 lp->stats.tx_fifo_errors++;
769 "%s: wv_complete(): tx error: slow DMA.\n",
773 if (tx_status & AC_SFLD_S6) {
774 lp->stats.tx_heartbeat_errors++;
777 "%s: wv_complete(): tx error: heart beat.\n",
781 if (tx_status & AC_SFLD_S5) {
782 lp->stats.tx_aborted_errors++;
785 "%s: wv_complete(): tx error: too many collisions.\n",
793 "%s: wv_complete(): tx completed, tx_status 0x%04x\n",
794 dev->name, tx_status);
798 #ifdef DEBUG_INTERRUPT_INFO
800 printk(KERN_DEBUG "%s: wv_complete(): reaped %d\n",
805 * Inform upper layers.
807 if (lp->tx_n_in_use < NTXBLOCKS - 1) {
808 netif_wake_queue(dev);
810 #ifdef DEBUG_INTERRUPT_TRACE
811 printk(KERN_DEBUG "%s: <-wv_complete()\n", dev->name);
816 /*------------------------------------------------------------------*/
818 * Reconfigure the i82586, or at least ask for it.
819 * Because wv_82586_config uses a transmission buffer, we must do it
820 * when we are sure that there is one left, so we do it now
821 * or in wavelan_packet_xmit() (I can't find any better place,
822 * wavelan_interrupt is not an option), so you may experience
825 static void wv_82586_reconfig(struct net_device * dev)
827 net_local *lp = (net_local *) dev->priv;
830 /* Arm the flag, will be cleard in wv_82586_config() */
831 lp->reconfig_82586 = 1;
833 /* Check if we can do it now ! */
834 if((netif_running(dev)) && !(netif_queue_stopped(dev))) {
835 spin_lock_irqsave(&lp->spinlock, flags);
837 wv_82586_config(dev);
838 spin_unlock_irqrestore(&lp->spinlock, flags);
841 #ifdef DEBUG_CONFIG_INFO
843 "%s: wv_82586_reconfig(): delayed (state = %lX)\n",
844 dev->name, dev->state);
849 /********************* DEBUG & INFO SUBROUTINES *********************/
851 * This routine is used in the code to show information for debugging.
852 * Most of the time, it dumps the contents of hardware structures.
855 #ifdef DEBUG_PSA_SHOW
856 /*------------------------------------------------------------------*/
858 * Print the formatted contents of the Parameter Storage Area.
860 static void wv_psa_show(psa_t * p)
862 DECLARE_MAC_BUF(mac);
864 printk(KERN_DEBUG "##### WaveLAN PSA contents: #####\n");
865 printk(KERN_DEBUG "psa_io_base_addr_1: 0x%02X %02X %02X %02X\n",
866 p->psa_io_base_addr_1,
867 p->psa_io_base_addr_2,
868 p->psa_io_base_addr_3, p->psa_io_base_addr_4);
869 printk(KERN_DEBUG "psa_rem_boot_addr_1: 0x%02X %02X %02X\n",
870 p->psa_rem_boot_addr_1,
871 p->psa_rem_boot_addr_2, p->psa_rem_boot_addr_3);
872 printk(KERN_DEBUG "psa_holi_params: 0x%02x, ", p->psa_holi_params);
873 printk("psa_int_req_no: %d\n", p->psa_int_req_no);
874 #ifdef DEBUG_SHOW_UNUSED
875 printk(KERN_DEBUG "psa_unused0[]: %s\n",
876 print_mac(mac, p->psa_unused0));
877 #endif /* DEBUG_SHOW_UNUSED */
878 printk(KERN_DEBUG "psa_univ_mac_addr[]: %s\n",
879 print_mac(mac, p->psa_univ_mac_addr));
880 printk(KERN_DEBUG "psa_local_mac_addr[]: %s\n",
881 print_mac(mac, p->psa_local_mac_addr));
882 printk(KERN_DEBUG "psa_univ_local_sel: %d, ",
883 p->psa_univ_local_sel);
884 printk("psa_comp_number: %d, ", p->psa_comp_number);
885 printk("psa_thr_pre_set: 0x%02x\n", p->psa_thr_pre_set);
886 printk(KERN_DEBUG "psa_feature_select/decay_prm: 0x%02x, ",
887 p->psa_feature_select);
888 printk("psa_subband/decay_update_prm: %d\n", p->psa_subband);
889 printk(KERN_DEBUG "psa_quality_thr: 0x%02x, ", p->psa_quality_thr);
890 printk("psa_mod_delay: 0x%02x\n", p->psa_mod_delay);
891 printk(KERN_DEBUG "psa_nwid: 0x%02x%02x, ", p->psa_nwid[0],
893 printk("psa_nwid_select: %d\n", p->psa_nwid_select);
894 printk(KERN_DEBUG "psa_encryption_select: %d, ",
895 p->psa_encryption_select);
897 ("psa_encryption_key[]: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
898 p->psa_encryption_key[0], p->psa_encryption_key[1],
899 p->psa_encryption_key[2], p->psa_encryption_key[3],
900 p->psa_encryption_key[4], p->psa_encryption_key[5],
901 p->psa_encryption_key[6], p->psa_encryption_key[7]);
902 printk(KERN_DEBUG "psa_databus_width: %d\n", p->psa_databus_width);
903 printk(KERN_DEBUG "psa_call_code/auto_squelch: 0x%02x, ",
904 p->psa_call_code[0]);
906 ("psa_call_code[]: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
907 p->psa_call_code[0], p->psa_call_code[1], p->psa_call_code[2],
908 p->psa_call_code[3], p->psa_call_code[4], p->psa_call_code[5],
909 p->psa_call_code[6], p->psa_call_code[7]);
910 #ifdef DEBUG_SHOW_UNUSED
911 printk(KERN_DEBUG "psa_reserved[]: %02X:%02X\n",
914 #endif /* DEBUG_SHOW_UNUSED */
915 printk(KERN_DEBUG "psa_conf_status: %d, ", p->psa_conf_status);
916 printk("psa_crc: 0x%02x%02x, ", p->psa_crc[0], p->psa_crc[1]);
917 printk("psa_crc_status: 0x%02x\n", p->psa_crc_status);
919 #endif /* DEBUG_PSA_SHOW */
921 #ifdef DEBUG_MMC_SHOW
922 /*------------------------------------------------------------------*/
924 * Print the formatted status of the Modem Management Controller.
925 * This function needs to be completed.
927 static void wv_mmc_show(struct net_device * dev)
929 unsigned long ioaddr = dev->base_addr;
930 net_local *lp = (net_local *) dev->priv;
934 if (hasr_read(ioaddr) & HASR_NO_CLK) {
936 "%s: wv_mmc_show: modem not connected\n",
942 mmc_out(ioaddr, mmwoff(0, mmw_freeze), 1);
943 mmc_read(ioaddr, 0, (u8 *) & m, sizeof(m));
944 mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0);
946 /* Don't forget to update statistics */
947 lp->wstats.discard.nwid +=
948 (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l;
950 printk(KERN_DEBUG "##### WaveLAN modem status registers: #####\n");
951 #ifdef DEBUG_SHOW_UNUSED
953 "mmc_unused0[]: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
954 m.mmr_unused0[0], m.mmr_unused0[1], m.mmr_unused0[2],
955 m.mmr_unused0[3], m.mmr_unused0[4], m.mmr_unused0[5],
956 m.mmr_unused0[6], m.mmr_unused0[7]);
957 #endif /* DEBUG_SHOW_UNUSED */
958 printk(KERN_DEBUG "Encryption algorithm: %02X - Status: %02X\n",
959 m.mmr_des_avail, m.mmr_des_status);
960 #ifdef DEBUG_SHOW_UNUSED
961 printk(KERN_DEBUG "mmc_unused1[]: %02X:%02X:%02X:%02X:%02X\n",
964 m.mmr_unused1[2], m.mmr_unused1[3], m.mmr_unused1[4]);
965 #endif /* DEBUG_SHOW_UNUSED */
966 printk(KERN_DEBUG "dce_status: 0x%x [%s%s%s%s]\n",
969 mmr_dce_status & MMR_DCE_STATUS_RX_BUSY) ?
970 "energy detected," : "",
972 mmr_dce_status & MMR_DCE_STATUS_LOOPT_IND) ?
973 "loop test indicated," : "",
975 mmr_dce_status & MMR_DCE_STATUS_TX_BUSY) ?
976 "transmitter on," : "",
978 mmr_dce_status & MMR_DCE_STATUS_JBR_EXPIRED) ?
979 "jabber timer expired," : "");
980 printk(KERN_DEBUG "Dsp ID: %02X\n", m.mmr_dsp_id);
981 #ifdef DEBUG_SHOW_UNUSED
982 printk(KERN_DEBUG "mmc_unused2[]: %02X:%02X\n",
983 m.mmr_unused2[0], m.mmr_unused2[1]);
984 #endif /* DEBUG_SHOW_UNUSED */
985 printk(KERN_DEBUG "# correct_nwid: %d, # wrong_nwid: %d\n",
986 (m.mmr_correct_nwid_h << 8) | m.mmr_correct_nwid_l,
987 (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l);
988 printk(KERN_DEBUG "thr_pre_set: 0x%x [current signal %s]\n",
989 m.mmr_thr_pre_set & MMR_THR_PRE_SET,
991 mmr_thr_pre_set & MMR_THR_PRE_SET_CUR) ? "above" :
993 printk(KERN_DEBUG "signal_lvl: %d [%s], ",
994 m.mmr_signal_lvl & MMR_SIGNAL_LVL,
996 mmr_signal_lvl & MMR_SIGNAL_LVL_VALID) ? "new msg" :
998 printk("silence_lvl: %d [%s], ",
999 m.mmr_silence_lvl & MMR_SILENCE_LVL,
1001 mmr_silence_lvl & MMR_SILENCE_LVL_VALID) ? "update done" :
1003 printk("sgnl_qual: 0x%x [%s]\n", m.mmr_sgnl_qual & MMR_SGNL_QUAL,
1005 mmr_sgnl_qual & MMR_SGNL_QUAL_ANT) ? "Antenna 1" :
1007 #ifdef DEBUG_SHOW_UNUSED
1008 printk(KERN_DEBUG "netw_id_l: %x\n", m.mmr_netw_id_l);
1009 #endif /* DEBUG_SHOW_UNUSED */
1011 #endif /* DEBUG_MMC_SHOW */
1013 #ifdef DEBUG_I82586_SHOW
1014 /*------------------------------------------------------------------*/
1016 * Print the last block of the i82586 memory.
1018 static void wv_scb_show(unsigned long ioaddr)
1022 obram_read(ioaddr, OFFSET_SCB, (unsigned char *) &scb,
1025 printk(KERN_DEBUG "##### WaveLAN system control block: #####\n");
1027 printk(KERN_DEBUG "status: ");
1028 printk("stat 0x%x[%s%s%s%s] ",
1030 scb_status & (SCB_ST_CX | SCB_ST_FR | SCB_ST_CNA |
1033 scb_status & SCB_ST_CX) ? "command completion interrupt," :
1034 "", (scb.scb_status & SCB_ST_FR) ? "frame received," : "",
1036 scb_status & SCB_ST_CNA) ? "command unit not active," : "",
1038 scb_status & SCB_ST_RNR) ? "receiving unit not ready," :
1040 printk("cus 0x%x[%s%s%s] ", (scb.scb_status & SCB_ST_CUS) >> 8,
1041 ((scb.scb_status & SCB_ST_CUS) ==
1042 SCB_ST_CUS_IDLE) ? "idle" : "",
1043 ((scb.scb_status & SCB_ST_CUS) ==
1044 SCB_ST_CUS_SUSP) ? "suspended" : "",
1045 ((scb.scb_status & SCB_ST_CUS) ==
1046 SCB_ST_CUS_ACTV) ? "active" : "");
1047 printk("rus 0x%x[%s%s%s%s]\n", (scb.scb_status & SCB_ST_RUS) >> 4,
1048 ((scb.scb_status & SCB_ST_RUS) ==
1049 SCB_ST_RUS_IDLE) ? "idle" : "",
1050 ((scb.scb_status & SCB_ST_RUS) ==
1051 SCB_ST_RUS_SUSP) ? "suspended" : "",
1052 ((scb.scb_status & SCB_ST_RUS) ==
1053 SCB_ST_RUS_NRES) ? "no resources" : "",
1054 ((scb.scb_status & SCB_ST_RUS) ==
1055 SCB_ST_RUS_RDY) ? "ready" : "");
1057 printk(KERN_DEBUG "command: ");
1058 printk("ack 0x%x[%s%s%s%s] ",
1060 scb_command & (SCB_CMD_ACK_CX | SCB_CMD_ACK_FR |
1061 SCB_CMD_ACK_CNA | SCB_CMD_ACK_RNR)) >> 12,
1063 scb_command & SCB_CMD_ACK_CX) ? "ack cmd completion," : "",
1065 scb_command & SCB_CMD_ACK_FR) ? "ack frame received," : "",
1067 scb_command & SCB_CMD_ACK_CNA) ? "ack CU not active," : "",
1069 scb_command & SCB_CMD_ACK_RNR) ? "ack RU not ready," : "");
1070 printk("cuc 0x%x[%s%s%s%s%s] ",
1071 (scb.scb_command & SCB_CMD_CUC) >> 8,
1072 ((scb.scb_command & SCB_CMD_CUC) ==
1073 SCB_CMD_CUC_NOP) ? "nop" : "",
1074 ((scb.scb_command & SCB_CMD_CUC) ==
1075 SCB_CMD_CUC_GO) ? "start cbl_offset" : "",
1076 ((scb.scb_command & SCB_CMD_CUC) ==
1077 SCB_CMD_CUC_RES) ? "resume execution" : "",
1078 ((scb.scb_command & SCB_CMD_CUC) ==
1079 SCB_CMD_CUC_SUS) ? "suspend execution" : "",
1080 ((scb.scb_command & SCB_CMD_CUC) ==
1081 SCB_CMD_CUC_ABT) ? "abort execution" : "");
1082 printk("ruc 0x%x[%s%s%s%s%s]\n",
1083 (scb.scb_command & SCB_CMD_RUC) >> 4,
1084 ((scb.scb_command & SCB_CMD_RUC) ==
1085 SCB_CMD_RUC_NOP) ? "nop" : "",
1086 ((scb.scb_command & SCB_CMD_RUC) ==
1087 SCB_CMD_RUC_GO) ? "start rfa_offset" : "",
1088 ((scb.scb_command & SCB_CMD_RUC) ==
1089 SCB_CMD_RUC_RES) ? "resume reception" : "",
1090 ((scb.scb_command & SCB_CMD_RUC) ==
1091 SCB_CMD_RUC_SUS) ? "suspend reception" : "",
1092 ((scb.scb_command & SCB_CMD_RUC) ==
1093 SCB_CMD_RUC_ABT) ? "abort reception" : "");
1095 printk(KERN_DEBUG "cbl_offset 0x%x ", scb.scb_cbl_offset);
1096 printk("rfa_offset 0x%x\n", scb.scb_rfa_offset);
1098 printk(KERN_DEBUG "crcerrs %d ", scb.scb_crcerrs);
1099 printk("alnerrs %d ", scb.scb_alnerrs);
1100 printk("rscerrs %d ", scb.scb_rscerrs);
1101 printk("ovrnerrs %d\n", scb.scb_ovrnerrs);
1104 /*------------------------------------------------------------------*/
1106 * Print the formatted status of the i82586's receive unit.
1108 static void wv_ru_show(struct net_device * dev)
1110 /* net_local *lp = (net_local *) dev->priv; */
1113 "##### WaveLAN i82586 receiver unit status: #####\n");
1114 printk(KERN_DEBUG "ru:");
1116 * Not implemented yet
1121 /*------------------------------------------------------------------*/
1123 * Display info about one control block of the i82586 memory.
1125 static void wv_cu_show_one(struct net_device * dev, net_local * lp, int i, u16 p)
1127 unsigned long ioaddr;
1130 ioaddr = dev->base_addr;
1132 printk("%d: 0x%x:", i, p);
1134 obram_read(ioaddr, p, (unsigned char *) &actx, sizeof(actx));
1135 printk(" status=0x%x,", actx.tx_h.ac_status);
1136 printk(" command=0x%x,", actx.tx_h.ac_command);
1142 obram_read(ioaddr, actx.tx_tbd_offset, (unsigned char *)&tbd, sizeof(tbd));
1143 printk(" tbd_status=0x%x,", tbd.tbd_status);
1150 /*------------------------------------------------------------------*/
1152 * Print status of the command unit of the i82586.
1154 static void wv_cu_show(struct net_device * dev)
1156 net_local *lp = (net_local *) dev->priv;
1161 "##### WaveLAN i82586 command unit status: #####\n");
1164 for (i = 0, p = lp->tx_first_in_use; i < NTXBLOCKS; i++) {
1165 wv_cu_show_one(dev, lp, i, p);
1168 if (p >= OFFSET_CU + NTXBLOCKS * TXBLOCKZ)
1169 p -= NTXBLOCKS * TXBLOCKZ;
1173 #endif /* DEBUG_I82586_SHOW */
1175 #ifdef DEBUG_DEVICE_SHOW
1176 /*------------------------------------------------------------------*/
1178 * Print the formatted status of the WaveLAN PCMCIA device driver.
1180 static void wv_dev_show(struct net_device * dev)
1182 printk(KERN_DEBUG "dev:");
1183 printk(" state=%lX,", dev->state);
1184 printk(" trans_start=%ld,", dev->trans_start);
1185 printk(" flags=0x%x,", dev->flags);
1189 /*------------------------------------------------------------------*/
1191 * Print the formatted status of the WaveLAN PCMCIA device driver's
1192 * private information.
1194 static void wv_local_show(struct net_device * dev)
1198 lp = (net_local *) dev->priv;
1200 printk(KERN_DEBUG "local:");
1201 printk(" tx_n_in_use=%d,", lp->tx_n_in_use);
1202 printk(" hacr=0x%x,", lp->hacr);
1203 printk(" rx_head=0x%x,", lp->rx_head);
1204 printk(" rx_last=0x%x,", lp->rx_last);
1205 printk(" tx_first_free=0x%x,", lp->tx_first_free);
1206 printk(" tx_first_in_use=0x%x,", lp->tx_first_in_use);
1208 } /* wv_local_show */
1209 #endif /* DEBUG_DEVICE_SHOW */
1211 #if defined(DEBUG_RX_INFO) || defined(DEBUG_TX_INFO)
1212 /*------------------------------------------------------------------*/
1214 * Dump packet header (and content if necessary) on the screen
1216 static inline void wv_packet_info(u8 * p, /* Packet to dump */
1217 int length, /* Length of the packet */
1218 char *msg1, /* Name of the device */
1220 { /* Name of the function */
1223 DECLARE_MAC_BUF(mac);
1226 "%s: %s(): dest %s, length %d\n",
1227 msg1, msg2, print_mac(mac, p), length);
1229 "%s: %s(): src %s, type 0x%02X%02X\n",
1230 msg1, msg2, print_mac(mac, &p[6]), p[12], p[13]);
1232 #ifdef DEBUG_PACKET_DUMP
1234 printk(KERN_DEBUG "data=\"");
1236 if ((maxi = length) > DEBUG_PACKET_DUMP)
1237 maxi = DEBUG_PACKET_DUMP;
1238 for (i = 14; i < maxi; i++)
1239 if (p[i] >= ' ' && p[i] <= '~')
1240 printk(" %c", p[i]);
1242 printk("%02X", p[i]);
1246 printk(KERN_DEBUG "\n");
1247 #endif /* DEBUG_PACKET_DUMP */
1249 #endif /* defined(DEBUG_RX_INFO) || defined(DEBUG_TX_INFO) */
1251 /*------------------------------------------------------------------*/
1253 * This is the information which is displayed by the driver at startup.
1254 * There are lots of flags for configuring it to your liking.
1256 static void wv_init_info(struct net_device * dev)
1258 short ioaddr = dev->base_addr;
1259 net_local *lp = (net_local *) dev->priv;
1261 #ifdef DEBUG_BASIC_SHOW
1262 DECLARE_MAC_BUF(mac);
1265 /* Read the parameter storage area */
1266 psa_read(ioaddr, lp->hacr, 0, (unsigned char *) &psa, sizeof(psa));
1268 #ifdef DEBUG_PSA_SHOW
1271 #ifdef DEBUG_MMC_SHOW
1274 #ifdef DEBUG_I82586_SHOW
1278 #ifdef DEBUG_BASIC_SHOW
1279 /* Now, let's go for the basic stuff. */
1280 printk(KERN_NOTICE "%s: WaveLAN at %#x, %s, IRQ %d",
1281 dev->name, ioaddr, print_mac(mac, dev->dev_addr), dev->irq);
1283 /* Print current network ID. */
1284 if (psa.psa_nwid_select)
1285 printk(", nwid 0x%02X-%02X", psa.psa_nwid[0],
1288 printk(", nwid off");
1291 if (!(mmc_in(ioaddr, mmroff(0, mmr_fee_status)) &
1292 (MMR_FEE_STATUS_DWLD | MMR_FEE_STATUS_BUSY))) {
1293 unsigned short freq;
1295 /* Ask the EEPROM to read the frequency from the first area. */
1296 fee_read(ioaddr, 0x00, &freq, 1);
1298 /* Print frequency */
1299 printk(", 2.00, %ld", (freq >> 6) + 2400L);
1306 switch (psa.psa_comp_number) {
1307 case PSA_COMP_PC_AT_915:
1308 case PSA_COMP_PC_AT_2400:
1311 case PSA_COMP_PC_MC_915:
1312 case PSA_COMP_PC_MC_2400:
1315 case PSA_COMP_PCMCIA_915:
1322 switch (psa.psa_subband) {
1323 case PSA_SUBBAND_915:
1326 case PSA_SUBBAND_2425:
1329 case PSA_SUBBAND_2460:
1332 case PSA_SUBBAND_2484:
1335 case PSA_SUBBAND_2430_5:
1344 #endif /* DEBUG_BASIC_SHOW */
1346 #ifdef DEBUG_VERSION_SHOW
1347 /* Print version information */
1348 printk(KERN_NOTICE "%s", version);
1350 } /* wv_init_info */
1352 /********************* IOCTL, STATS & RECONFIG *********************/
1354 * We found here routines that are called by Linux on different
1355 * occasions after the configuration and not for transmitting data
1356 * These may be called when the user use ifconfig, /proc/net/dev
1357 * or wireless extensions
1360 /*------------------------------------------------------------------*/
1362 * Get the current Ethernet statistics. This may be called with the
1363 * card open or closed.
1364 * Used when the user read /proc/net/dev
1366 static en_stats *wavelan_get_stats(struct net_device * dev)
1368 #ifdef DEBUG_IOCTL_TRACE
1369 printk(KERN_DEBUG "%s: <>wavelan_get_stats()\n", dev->name);
1372 return (&((net_local *) dev->priv)->stats);
1375 /*------------------------------------------------------------------*/
1377 * Set or clear the multicast filter for this adaptor.
1378 * num_addrs == -1 Promiscuous mode, receive all packets
1379 * num_addrs == 0 Normal mode, clear multicast list
1380 * num_addrs > 0 Multicast mode, receive normal and MC packets,
1381 * and do best-effort filtering.
1383 static void wavelan_set_multicast_list(struct net_device * dev)
1385 net_local *lp = (net_local *) dev->priv;
1387 #ifdef DEBUG_IOCTL_TRACE
1388 printk(KERN_DEBUG "%s: ->wavelan_set_multicast_list()\n",
1392 #ifdef DEBUG_IOCTL_INFO
1394 "%s: wavelan_set_multicast_list(): setting Rx mode %02X to %d addresses.\n",
1395 dev->name, dev->flags, dev->mc_count);
1398 /* Are we asking for promiscuous mode,
1399 * or all multicast addresses (we don't have that!)
1400 * or too many multicast addresses for the hardware filter? */
1401 if ((dev->flags & IFF_PROMISC) ||
1402 (dev->flags & IFF_ALLMULTI) ||
1403 (dev->mc_count > I82586_MAX_MULTICAST_ADDRESSES)) {
1405 * Enable promiscuous mode: receive all packets.
1407 if (!lp->promiscuous) {
1408 lp->promiscuous = 1;
1411 wv_82586_reconfig(dev);
1414 /* Are there multicast addresses to send? */
1415 if (dev->mc_list != (struct dev_mc_list *) NULL) {
1417 * Disable promiscuous mode, but receive all packets
1420 #ifdef MULTICAST_AVOID
1421 if (lp->promiscuous || (dev->mc_count != lp->mc_count))
1424 lp->promiscuous = 0;
1425 lp->mc_count = dev->mc_count;
1427 wv_82586_reconfig(dev);
1431 * Switch to normal mode: disable promiscuous mode and
1432 * clear the multicast list.
1434 if (lp->promiscuous || lp->mc_count == 0) {
1435 lp->promiscuous = 0;
1438 wv_82586_reconfig(dev);
1441 #ifdef DEBUG_IOCTL_TRACE
1442 printk(KERN_DEBUG "%s: <-wavelan_set_multicast_list()\n",
1447 /*------------------------------------------------------------------*/
1449 * This function doesn't exist.
1450 * (Note : it was a nice way to test the reconfigure stuff...)
1452 #ifdef SET_MAC_ADDRESS
1453 static int wavelan_set_mac_address(struct net_device * dev, void *addr)
1455 struct sockaddr *mac = addr;
1457 /* Copy the address. */
1458 memcpy(dev->dev_addr, mac->sa_data, WAVELAN_ADDR_SIZE);
1460 /* Reconfigure the beast. */
1461 wv_82586_reconfig(dev);
1465 #endif /* SET_MAC_ADDRESS */
1468 /*------------------------------------------------------------------*/
1470 * Frequency setting (for hardware capable of it)
1471 * It's a bit complicated and you don't really want to look into it.
1472 * (called in wavelan_ioctl)
1474 static int wv_set_frequency(unsigned long ioaddr, /* I/O port of the card */
1475 iw_freq * frequency)
1477 const int BAND_NUM = 10; /* Number of bands */
1478 long freq = 0L; /* offset to 2.4 GHz in .5 MHz */
1479 #ifdef DEBUG_IOCTL_INFO
1483 /* Setting by frequency */
1484 /* Theoretically, you may set any frequency between
1485 * the two limits with a 0.5 MHz precision. In practice,
1486 * I don't want you to have trouble with local regulations.
1488 if ((frequency->e == 1) &&
1489 (frequency->m >= (int) 2.412e8)
1490 && (frequency->m <= (int) 2.487e8)) {
1491 freq = ((frequency->m / 10000) - 24000L) / 5;
1494 /* Setting by channel (same as wfreqsel) */
1495 /* Warning: each channel is 22 MHz wide, so some of the channels
1496 * will interfere. */
1497 if ((frequency->e == 0) && (frequency->m < BAND_NUM)) {
1498 /* Get frequency offset. */
1499 freq = channel_bands[frequency->m] >> 1;
1502 /* Verify that the frequency is allowed. */
1504 u16 table[10]; /* Authorized frequency table */
1506 /* Read the frequency table. */
1507 fee_read(ioaddr, 0x71, table, 10);
1509 #ifdef DEBUG_IOCTL_INFO
1510 printk(KERN_DEBUG "Frequency table: ");
1511 for (i = 0; i < 10; i++) {
1512 printk(" %04X", table[i]);
1517 /* Look in the table to see whether the frequency is allowed. */
1518 if (!(table[9 - ((freq - 24) / 16)] &
1519 (1 << ((freq - 24) % 16)))) return -EINVAL; /* not allowed */
1523 /* if we get a usable frequency */
1525 unsigned short area[16];
1526 unsigned short dac[2];
1527 unsigned short area_verify[16];
1528 unsigned short dac_verify[2];
1529 /* Corresponding gain (in the power adjust value table)
1530 * See AT&T WaveLAN Data Manual, REF 407-024689/E, page 3-8
1531 * and WCIN062D.DOC, page 6.2.9. */
1532 unsigned short power_limit[] = { 40, 80, 120, 160, 0 };
1533 int power_band = 0; /* Selected band */
1534 unsigned short power_adjust; /* Correct value */
1536 /* Search for the gain. */
1538 while ((freq > power_limit[power_band]) &&
1539 (power_limit[++power_band] != 0));
1541 /* Read the first area. */
1542 fee_read(ioaddr, 0x00, area, 16);
1545 fee_read(ioaddr, 0x60, dac, 2);
1547 /* Read the new power adjust value. */
1548 fee_read(ioaddr, 0x6B - (power_band >> 1), &power_adjust,
1550 if (power_band & 0x1)
1553 power_adjust &= 0xFF;
1555 #ifdef DEBUG_IOCTL_INFO
1556 printk(KERN_DEBUG "WaveLAN EEPROM Area 1: ");
1557 for (i = 0; i < 16; i++) {
1558 printk(" %04X", area[i]);
1562 printk(KERN_DEBUG "WaveLAN EEPROM DAC: %04X %04X\n",
1566 /* Frequency offset (for info only) */
1567 area[0] = ((freq << 5) & 0xFFE0) | (area[0] & 0x1F);
1569 /* Receiver Principle main divider coefficient */
1570 area[3] = (freq >> 1) + 2400L - 352L;
1571 area[2] = ((freq & 0x1) << 4) | (area[2] & 0xFFEF);
1573 /* Transmitter Main divider coefficient */
1574 area[13] = (freq >> 1) + 2400L;
1575 area[12] = ((freq & 0x1) << 4) | (area[2] & 0xFFEF);
1577 /* Other parts of the area are flags, bit streams or unused. */
1579 /* Set the value in the DAC. */
1580 dac[1] = ((power_adjust >> 1) & 0x7F) | (dac[1] & 0xFF80);
1581 dac[0] = ((power_adjust & 0x1) << 4) | (dac[0] & 0xFFEF);
1583 /* Write the first area. */
1584 fee_write(ioaddr, 0x00, area, 16);
1586 /* Write the DAC. */
1587 fee_write(ioaddr, 0x60, dac, 2);
1589 /* We now should verify here that the writing of the EEPROM went OK. */
1591 /* Reread the first area. */
1592 fee_read(ioaddr, 0x00, area_verify, 16);
1594 /* Reread the DAC. */
1595 fee_read(ioaddr, 0x60, dac_verify, 2);
1598 if (memcmp(area, area_verify, 16 * 2) ||
1599 memcmp(dac, dac_verify, 2 * 2)) {
1600 #ifdef DEBUG_IOCTL_ERROR
1602 "WaveLAN: wv_set_frequency: unable to write new frequency to EEPROM(?).\n");
1607 /* We must download the frequency parameters to the
1608 * synthesizers (from the EEPROM - area 1)
1609 * Note: as the EEPROM is automatically decremented, we set the end
1611 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), 0x0F);
1612 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl),
1613 MMW_FEE_CTRL_READ | MMW_FEE_CTRL_DWLD);
1615 /* Wait until the download is finished. */
1616 fee_wait(ioaddr, 100, 100);
1618 /* We must now download the power adjust value (gain) to
1619 * the synthesizers (from the EEPROM - area 7 - DAC). */
1620 mmc_out(ioaddr, mmwoff(0, mmw_fee_addr), 0x61);
1621 mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl),
1622 MMW_FEE_CTRL_READ | MMW_FEE_CTRL_DWLD);
1624 /* Wait for the download to finish. */
1625 fee_wait(ioaddr, 100, 100);
1627 #ifdef DEBUG_IOCTL_INFO
1628 /* Verification of what we have done */
1630 printk(KERN_DEBUG "WaveLAN EEPROM Area 1: ");
1631 for (i = 0; i < 16; i++) {
1632 printk(" %04X", area_verify[i]);
1636 printk(KERN_DEBUG "WaveLAN EEPROM DAC: %04X %04X\n",
1637 dac_verify[0], dac_verify[1]);
1642 return -EINVAL; /* Bah, never get there... */
1645 /*------------------------------------------------------------------*/
1647 * Give the list of available frequencies.
1649 static int wv_frequency_list(unsigned long ioaddr, /* I/O port of the card */
1650 iw_freq * list, /* List of frequencies to fill */
1652 { /* Maximum number of frequencies */
1653 u16 table[10]; /* Authorized frequency table */
1654 long freq = 0L; /* offset to 2.4 GHz in .5 MHz + 12 MHz */
1655 int i; /* index in the table */
1656 int c = 0; /* Channel number */
1658 /* Read the frequency table. */
1659 fee_read(ioaddr, 0x71 /* frequency table */ , table, 10);
1661 /* Check all frequencies. */
1663 for (freq = 0; freq < 150; freq++)
1664 /* Look in the table if the frequency is allowed */
1665 if (table[9 - (freq / 16)] & (1 << (freq % 16))) {
1666 /* Compute approximate channel number */
1667 while ((c < ARRAY_SIZE(channel_bands)) &&
1668 (((channel_bands[c] >> 1) - 24) < freq))
1670 list[i].i = c; /* Set the list index */
1672 /* put in the list */
1673 list[i].m = (((freq + 24) * 5) + 24000L) * 10000;
1684 #ifdef IW_WIRELESS_SPY
1685 /*------------------------------------------------------------------*/
1687 * Gather wireless spy statistics: for each packet, compare the source
1688 * address with our list, and if they match, get the statistics.
1689 * Sorry, but this function really needs the wireless extensions.
1691 static inline void wl_spy_gather(struct net_device * dev,
1692 u8 * mac, /* MAC address */
1693 u8 * stats) /* Statistics to gather */
1695 struct iw_quality wstats;
1697 wstats.qual = stats[2] & MMR_SGNL_QUAL;
1698 wstats.level = stats[0] & MMR_SIGNAL_LVL;
1699 wstats.noise = stats[1] & MMR_SILENCE_LVL;
1700 wstats.updated = 0x7;
1702 /* Update spy records */
1703 wireless_spy_update(dev, mac, &wstats);
1705 #endif /* IW_WIRELESS_SPY */
1708 /*------------------------------------------------------------------*/
1710 * This function calculates a histogram of the signal level.
1711 * As the noise is quite constant, it's like doing it on the SNR.
1712 * We have defined a set of interval (lp->his_range), and each time
1713 * the level goes in that interval, we increment the count (lp->his_sum).
1714 * With this histogram you may detect if one WaveLAN is really weak,
1715 * or you may also calculate the mean and standard deviation of the level.
1717 static inline void wl_his_gather(struct net_device * dev, u8 * stats)
1718 { /* Statistics to gather */
1719 net_local *lp = (net_local *) dev->priv;
1720 u8 level = stats[0] & MMR_SIGNAL_LVL;
1723 /* Find the correct interval. */
1725 while ((i < (lp->his_number - 1))
1726 && (level >= lp->his_range[i++]));
1728 /* Increment interval counter. */
1731 #endif /* HISTOGRAM */
1733 /*------------------------------------------------------------------*/
1735 * Wireless Handler : get protocol name
1737 static int wavelan_get_name(struct net_device *dev,
1738 struct iw_request_info *info,
1739 union iwreq_data *wrqu,
1742 strcpy(wrqu->name, "WaveLAN");
1746 /*------------------------------------------------------------------*/
1748 * Wireless Handler : set NWID
1750 static int wavelan_set_nwid(struct net_device *dev,
1751 struct iw_request_info *info,
1752 union iwreq_data *wrqu,
1755 unsigned long ioaddr = dev->base_addr;
1756 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
1759 unsigned long flags;
1762 /* Disable interrupts and save flags. */
1763 spin_lock_irqsave(&lp->spinlock, flags);
1765 /* Set NWID in WaveLAN. */
1766 if (!wrqu->nwid.disabled) {
1767 /* Set NWID in psa */
1768 psa.psa_nwid[0] = (wrqu->nwid.value & 0xFF00) >> 8;
1769 psa.psa_nwid[1] = wrqu->nwid.value & 0xFF;
1770 psa.psa_nwid_select = 0x01;
1771 psa_write(ioaddr, lp->hacr,
1772 (char *) psa.psa_nwid - (char *) &psa,
1773 (unsigned char *) psa.psa_nwid, 3);
1775 /* Set NWID in mmc. */
1776 m.w.mmw_netw_id_l = psa.psa_nwid[1];
1777 m.w.mmw_netw_id_h = psa.psa_nwid[0];
1779 (char *) &m.w.mmw_netw_id_l -
1781 (unsigned char *) &m.w.mmw_netw_id_l, 2);
1782 mmc_out(ioaddr, mmwoff(0, mmw_loopt_sel), 0x00);
1784 /* Disable NWID in the psa. */
1785 psa.psa_nwid_select = 0x00;
1786 psa_write(ioaddr, lp->hacr,
1787 (char *) &psa.psa_nwid_select -
1789 (unsigned char *) &psa.psa_nwid_select,
1792 /* Disable NWID in the mmc (no filtering). */
1793 mmc_out(ioaddr, mmwoff(0, mmw_loopt_sel),
1794 MMW_LOOPT_SEL_DIS_NWID);
1796 /* update the Wavelan checksum */
1797 update_psa_checksum(dev, ioaddr, lp->hacr);
1799 /* Enable interrupts and restore flags. */
1800 spin_unlock_irqrestore(&lp->spinlock, flags);
1805 /*------------------------------------------------------------------*/
1807 * Wireless Handler : get NWID
1809 static int wavelan_get_nwid(struct net_device *dev,
1810 struct iw_request_info *info,
1811 union iwreq_data *wrqu,
1814 unsigned long ioaddr = dev->base_addr;
1815 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
1817 unsigned long flags;
1820 /* Disable interrupts and save flags. */
1821 spin_lock_irqsave(&lp->spinlock, flags);
1823 /* Read the NWID. */
1824 psa_read(ioaddr, lp->hacr,
1825 (char *) psa.psa_nwid - (char *) &psa,
1826 (unsigned char *) psa.psa_nwid, 3);
1827 wrqu->nwid.value = (psa.psa_nwid[0] << 8) + psa.psa_nwid[1];
1828 wrqu->nwid.disabled = !(psa.psa_nwid_select);
1829 wrqu->nwid.fixed = 1; /* Superfluous */
1831 /* Enable interrupts and restore flags. */
1832 spin_unlock_irqrestore(&lp->spinlock, flags);
1837 /*------------------------------------------------------------------*/
1839 * Wireless Handler : set frequency
1841 static int wavelan_set_freq(struct net_device *dev,
1842 struct iw_request_info *info,
1843 union iwreq_data *wrqu,
1846 unsigned long ioaddr = dev->base_addr;
1847 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
1848 unsigned long flags;
1851 /* Disable interrupts and save flags. */
1852 spin_lock_irqsave(&lp->spinlock, flags);
1854 /* Attempt to recognise 2.00 cards (2.4 GHz frequency selectable). */
1855 if (!(mmc_in(ioaddr, mmroff(0, mmr_fee_status)) &
1856 (MMR_FEE_STATUS_DWLD | MMR_FEE_STATUS_BUSY)))
1857 ret = wv_set_frequency(ioaddr, &(wrqu->freq));
1861 /* Enable interrupts and restore flags. */
1862 spin_unlock_irqrestore(&lp->spinlock, flags);
1867 /*------------------------------------------------------------------*/
1869 * Wireless Handler : get frequency
1871 static int wavelan_get_freq(struct net_device *dev,
1872 struct iw_request_info *info,
1873 union iwreq_data *wrqu,
1876 unsigned long ioaddr = dev->base_addr;
1877 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
1879 unsigned long flags;
1882 /* Disable interrupts and save flags. */
1883 spin_lock_irqsave(&lp->spinlock, flags);
1885 /* Attempt to recognise 2.00 cards (2.4 GHz frequency selectable).
1886 * Does it work for everybody, especially old cards? */
1887 if (!(mmc_in(ioaddr, mmroff(0, mmr_fee_status)) &
1888 (MMR_FEE_STATUS_DWLD | MMR_FEE_STATUS_BUSY))) {
1889 unsigned short freq;
1891 /* Ask the EEPROM to read the frequency from the first area. */
1892 fee_read(ioaddr, 0x00, &freq, 1);
1893 wrqu->freq.m = ((freq >> 5) * 5 + 24000L) * 10000;
1896 psa_read(ioaddr, lp->hacr,
1897 (char *) &psa.psa_subband - (char *) &psa,
1898 (unsigned char *) &psa.psa_subband, 1);
1900 if (psa.psa_subband <= 4) {
1901 wrqu->freq.m = fixed_bands[psa.psa_subband];
1902 wrqu->freq.e = (psa.psa_subband != 0);
1907 /* Enable interrupts and restore flags. */
1908 spin_unlock_irqrestore(&lp->spinlock, flags);
1913 /*------------------------------------------------------------------*/
1915 * Wireless Handler : set level threshold
1917 static int wavelan_set_sens(struct net_device *dev,
1918 struct iw_request_info *info,
1919 union iwreq_data *wrqu,
1922 unsigned long ioaddr = dev->base_addr;
1923 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
1925 unsigned long flags;
1928 /* Disable interrupts and save flags. */
1929 spin_lock_irqsave(&lp->spinlock, flags);
1931 /* Set the level threshold. */
1932 /* We should complain loudly if wrqu->sens.fixed = 0, because we
1933 * can't set auto mode... */
1934 psa.psa_thr_pre_set = wrqu->sens.value & 0x3F;
1935 psa_write(ioaddr, lp->hacr,
1936 (char *) &psa.psa_thr_pre_set - (char *) &psa,
1937 (unsigned char *) &psa.psa_thr_pre_set, 1);
1938 /* update the Wavelan checksum */
1939 update_psa_checksum(dev, ioaddr, lp->hacr);
1940 mmc_out(ioaddr, mmwoff(0, mmw_thr_pre_set),
1941 psa.psa_thr_pre_set);
1943 /* Enable interrupts and restore flags. */
1944 spin_unlock_irqrestore(&lp->spinlock, flags);
1949 /*------------------------------------------------------------------*/
1951 * Wireless Handler : get level threshold
1953 static int wavelan_get_sens(struct net_device *dev,
1954 struct iw_request_info *info,
1955 union iwreq_data *wrqu,
1958 unsigned long ioaddr = dev->base_addr;
1959 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
1961 unsigned long flags;
1964 /* Disable interrupts and save flags. */
1965 spin_lock_irqsave(&lp->spinlock, flags);
1967 /* Read the level threshold. */
1968 psa_read(ioaddr, lp->hacr,
1969 (char *) &psa.psa_thr_pre_set - (char *) &psa,
1970 (unsigned char *) &psa.psa_thr_pre_set, 1);
1971 wrqu->sens.value = psa.psa_thr_pre_set & 0x3F;
1972 wrqu->sens.fixed = 1;
1974 /* Enable interrupts and restore flags. */
1975 spin_unlock_irqrestore(&lp->spinlock, flags);
1980 /*------------------------------------------------------------------*/
1982 * Wireless Handler : set encryption key
1984 static int wavelan_set_encode(struct net_device *dev,
1985 struct iw_request_info *info,
1986 union iwreq_data *wrqu,
1989 unsigned long ioaddr = dev->base_addr;
1990 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
1991 unsigned long flags;
1995 /* Disable interrupts and save flags. */
1996 spin_lock_irqsave(&lp->spinlock, flags);
1998 /* Check if capable of encryption */
1999 if (!mmc_encr(ioaddr)) {
2003 /* Check the size of the key */
2004 if((wrqu->encoding.length != 8) && (wrqu->encoding.length != 0)) {
2009 /* Basic checking... */
2010 if (wrqu->encoding.length == 8) {
2011 /* Copy the key in the driver */
2012 memcpy(psa.psa_encryption_key, extra,
2013 wrqu->encoding.length);
2014 psa.psa_encryption_select = 1;
2016 psa_write(ioaddr, lp->hacr,
2017 (char *) &psa.psa_encryption_select -
2019 (unsigned char *) &psa.
2020 psa_encryption_select, 8 + 1);
2022 mmc_out(ioaddr, mmwoff(0, mmw_encr_enable),
2023 MMW_ENCR_ENABLE_EN | MMW_ENCR_ENABLE_MODE);
2024 mmc_write(ioaddr, mmwoff(0, mmw_encr_key),
2025 (unsigned char *) &psa.
2026 psa_encryption_key, 8);
2029 /* disable encryption */
2030 if (wrqu->encoding.flags & IW_ENCODE_DISABLED) {
2031 psa.psa_encryption_select = 0;
2032 psa_write(ioaddr, lp->hacr,
2033 (char *) &psa.psa_encryption_select -
2035 (unsigned char *) &psa.
2036 psa_encryption_select, 1);
2038 mmc_out(ioaddr, mmwoff(0, mmw_encr_enable), 0);
2040 /* update the Wavelan checksum */
2041 update_psa_checksum(dev, ioaddr, lp->hacr);
2044 /* Enable interrupts and restore flags. */
2045 spin_unlock_irqrestore(&lp->spinlock, flags);
2050 /*------------------------------------------------------------------*/
2052 * Wireless Handler : get encryption key
2054 static int wavelan_get_encode(struct net_device *dev,
2055 struct iw_request_info *info,
2056 union iwreq_data *wrqu,
2059 unsigned long ioaddr = dev->base_addr;
2060 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
2062 unsigned long flags;
2065 /* Disable interrupts and save flags. */
2066 spin_lock_irqsave(&lp->spinlock, flags);
2068 /* Check if encryption is available */
2069 if (!mmc_encr(ioaddr)) {
2072 /* Read the encryption key */
2073 psa_read(ioaddr, lp->hacr,
2074 (char *) &psa.psa_encryption_select -
2076 (unsigned char *) &psa.
2077 psa_encryption_select, 1 + 8);
2079 /* encryption is enabled ? */
2080 if (psa.psa_encryption_select)
2081 wrqu->encoding.flags = IW_ENCODE_ENABLED;
2083 wrqu->encoding.flags = IW_ENCODE_DISABLED;
2084 wrqu->encoding.flags |= mmc_encr(ioaddr);
2086 /* Copy the key to the user buffer */
2087 wrqu->encoding.length = 8;
2088 memcpy(extra, psa.psa_encryption_key, wrqu->encoding.length);
2091 /* Enable interrupts and restore flags. */
2092 spin_unlock_irqrestore(&lp->spinlock, flags);
2097 /*------------------------------------------------------------------*/
2099 * Wireless Handler : get range info
2101 static int wavelan_get_range(struct net_device *dev,
2102 struct iw_request_info *info,
2103 union iwreq_data *wrqu,
2106 unsigned long ioaddr = dev->base_addr;
2107 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
2108 struct iw_range *range = (struct iw_range *) extra;
2109 unsigned long flags;
2112 /* Set the length (very important for backward compatibility) */
2113 wrqu->data.length = sizeof(struct iw_range);
2115 /* Set all the info we don't care or don't know about to zero */
2116 memset(range, 0, sizeof(struct iw_range));
2118 /* Set the Wireless Extension versions */
2119 range->we_version_compiled = WIRELESS_EXT;
2120 range->we_version_source = 9;
2122 /* Set information in the range struct. */
2123 range->throughput = 1.6 * 1000 * 1000; /* don't argue on this ! */
2124 range->min_nwid = 0x0000;
2125 range->max_nwid = 0xFFFF;
2127 range->sensitivity = 0x3F;
2128 range->max_qual.qual = MMR_SGNL_QUAL;
2129 range->max_qual.level = MMR_SIGNAL_LVL;
2130 range->max_qual.noise = MMR_SILENCE_LVL;
2131 range->avg_qual.qual = MMR_SGNL_QUAL; /* Always max */
2132 /* Need to get better values for those two */
2133 range->avg_qual.level = 30;
2134 range->avg_qual.noise = 8;
2136 range->num_bitrates = 1;
2137 range->bitrate[0] = 2000000; /* 2 Mb/s */
2139 /* Event capability (kernel + driver) */
2140 range->event_capa[0] = (IW_EVENT_CAPA_MASK(0x8B02) |
2141 IW_EVENT_CAPA_MASK(0x8B04));
2142 range->event_capa[1] = IW_EVENT_CAPA_K_1;
2144 /* Disable interrupts and save flags. */
2145 spin_lock_irqsave(&lp->spinlock, flags);
2147 /* Attempt to recognise 2.00 cards (2.4 GHz frequency selectable). */
2148 if (!(mmc_in(ioaddr, mmroff(0, mmr_fee_status)) &
2149 (MMR_FEE_STATUS_DWLD | MMR_FEE_STATUS_BUSY))) {
2150 range->num_channels = 10;
2151 range->num_frequency = wv_frequency_list(ioaddr, range->freq,
2152 IW_MAX_FREQUENCIES);
2154 range->num_channels = range->num_frequency = 0;
2156 /* Encryption supported ? */
2157 if (mmc_encr(ioaddr)) {
2158 range->encoding_size[0] = 8; /* DES = 64 bits key */
2159 range->num_encoding_sizes = 1;
2160 range->max_encoding_tokens = 1; /* Only one key possible */
2162 range->num_encoding_sizes = 0;
2163 range->max_encoding_tokens = 0;
2166 /* Enable interrupts and restore flags. */
2167 spin_unlock_irqrestore(&lp->spinlock, flags);
2172 /*------------------------------------------------------------------*/
2174 * Wireless Private Handler : set quality threshold
2176 static int wavelan_set_qthr(struct net_device *dev,
2177 struct iw_request_info *info,
2178 union iwreq_data *wrqu,
2181 unsigned long ioaddr = dev->base_addr;
2182 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
2184 unsigned long flags;
2186 /* Disable interrupts and save flags. */
2187 spin_lock_irqsave(&lp->spinlock, flags);
2189 psa.psa_quality_thr = *(extra) & 0x0F;
2190 psa_write(ioaddr, lp->hacr,
2191 (char *) &psa.psa_quality_thr - (char *) &psa,
2192 (unsigned char *) &psa.psa_quality_thr, 1);
2193 /* update the Wavelan checksum */
2194 update_psa_checksum(dev, ioaddr, lp->hacr);
2195 mmc_out(ioaddr, mmwoff(0, mmw_quality_thr),
2196 psa.psa_quality_thr);
2198 /* Enable interrupts and restore flags. */
2199 spin_unlock_irqrestore(&lp->spinlock, flags);
2204 /*------------------------------------------------------------------*/
2206 * Wireless Private Handler : get quality threshold
2208 static int wavelan_get_qthr(struct net_device *dev,
2209 struct iw_request_info *info,
2210 union iwreq_data *wrqu,
2213 unsigned long ioaddr = dev->base_addr;
2214 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
2216 unsigned long flags;
2218 /* Disable interrupts and save flags. */
2219 spin_lock_irqsave(&lp->spinlock, flags);
2221 psa_read(ioaddr, lp->hacr,
2222 (char *) &psa.psa_quality_thr - (char *) &psa,
2223 (unsigned char *) &psa.psa_quality_thr, 1);
2224 *(extra) = psa.psa_quality_thr & 0x0F;
2226 /* Enable interrupts and restore flags. */
2227 spin_unlock_irqrestore(&lp->spinlock, flags);
2233 /*------------------------------------------------------------------*/
2235 * Wireless Private Handler : set histogram
2237 static int wavelan_set_histo(struct net_device *dev,
2238 struct iw_request_info *info,
2239 union iwreq_data *wrqu,
2242 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
2244 /* Check the number of intervals. */
2245 if (wrqu->data.length > 16) {
2249 /* Disable histo while we copy the addresses.
2250 * As we don't disable interrupts, we need to do this */
2253 /* Are there ranges to copy? */
2254 if (wrqu->data.length > 0) {
2255 /* Copy interval ranges to the driver */
2256 memcpy(lp->his_range, extra, wrqu->data.length);
2260 printk(KERN_DEBUG "Histo :");
2261 for(i = 0; i < wrqu->data.length; i++)
2262 printk(" %d", lp->his_range[i]);
2266 /* Reset result structure. */
2267 memset(lp->his_sum, 0x00, sizeof(long) * 16);
2270 /* Now we can set the number of ranges */
2271 lp->his_number = wrqu->data.length;
2276 /*------------------------------------------------------------------*/
2278 * Wireless Private Handler : get histogram
2280 static int wavelan_get_histo(struct net_device *dev,
2281 struct iw_request_info *info,
2282 union iwreq_data *wrqu,
2285 net_local *lp = (net_local *) dev->priv; /* lp is not unused */
2287 /* Set the number of intervals. */
2288 wrqu->data.length = lp->his_number;
2290 /* Give back the distribution statistics */
2291 if(lp->his_number > 0)
2292 memcpy(extra, lp->his_sum, sizeof(long) * lp->his_number);
2296 #endif /* HISTOGRAM */
2298 /*------------------------------------------------------------------*/
2300 * Structures to export the Wireless Handlers
2303 static const iw_handler wavelan_handler[] =
2305 NULL, /* SIOCSIWNAME */
2306 wavelan_get_name, /* SIOCGIWNAME */
2307 wavelan_set_nwid, /* SIOCSIWNWID */
2308 wavelan_get_nwid, /* SIOCGIWNWID */
2309 wavelan_set_freq, /* SIOCSIWFREQ */
2310 wavelan_get_freq, /* SIOCGIWFREQ */
2311 NULL, /* SIOCSIWMODE */
2312 NULL, /* SIOCGIWMODE */
2313 wavelan_set_sens, /* SIOCSIWSENS */
2314 wavelan_get_sens, /* SIOCGIWSENS */
2315 NULL, /* SIOCSIWRANGE */
2316 wavelan_get_range, /* SIOCGIWRANGE */
2317 NULL, /* SIOCSIWPRIV */
2318 NULL, /* SIOCGIWPRIV */
2319 NULL, /* SIOCSIWSTATS */
2320 NULL, /* SIOCGIWSTATS */
2321 iw_handler_set_spy, /* SIOCSIWSPY */
2322 iw_handler_get_spy, /* SIOCGIWSPY */
2323 iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
2324 iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
2325 NULL, /* SIOCSIWAP */
2326 NULL, /* SIOCGIWAP */
2327 NULL, /* -- hole -- */
2328 NULL, /* SIOCGIWAPLIST */
2329 NULL, /* -- hole -- */
2330 NULL, /* -- hole -- */
2331 NULL, /* SIOCSIWESSID */
2332 NULL, /* SIOCGIWESSID */
2333 NULL, /* SIOCSIWNICKN */
2334 NULL, /* SIOCGIWNICKN */
2335 NULL, /* -- hole -- */
2336 NULL, /* -- hole -- */
2337 NULL, /* SIOCSIWRATE */
2338 NULL, /* SIOCGIWRATE */
2339 NULL, /* SIOCSIWRTS */
2340 NULL, /* SIOCGIWRTS */
2341 NULL, /* SIOCSIWFRAG */
2342 NULL, /* SIOCGIWFRAG */
2343 NULL, /* SIOCSIWTXPOW */
2344 NULL, /* SIOCGIWTXPOW */
2345 NULL, /* SIOCSIWRETRY */
2346 NULL, /* SIOCGIWRETRY */
2347 /* Bummer ! Why those are only at the end ??? */
2348 wavelan_set_encode, /* SIOCSIWENCODE */
2349 wavelan_get_encode, /* SIOCGIWENCODE */
2352 static const iw_handler wavelan_private_handler[] =
2354 wavelan_set_qthr, /* SIOCIWFIRSTPRIV */
2355 wavelan_get_qthr, /* SIOCIWFIRSTPRIV + 1 */
2357 wavelan_set_histo, /* SIOCIWFIRSTPRIV + 2 */
2358 wavelan_get_histo, /* SIOCIWFIRSTPRIV + 3 */
2359 #endif /* HISTOGRAM */
2362 static const struct iw_priv_args wavelan_private_args[] = {
2363 /*{ cmd, set_args, get_args, name } */
2364 { SIOCSIPQTHR, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "setqualthr" },
2365 { SIOCGIPQTHR, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "getqualthr" },
2366 { SIOCSIPHISTO, IW_PRIV_TYPE_BYTE | 16, 0, "sethisto" },
2367 { SIOCGIPHISTO, 0, IW_PRIV_TYPE_INT | 16, "gethisto" },
2370 static const struct iw_handler_def wavelan_handler_def =
2372 .num_standard = ARRAY_SIZE(wavelan_handler),
2373 .num_private = ARRAY_SIZE(wavelan_private_handler),
2374 .num_private_args = ARRAY_SIZE(wavelan_private_args),
2375 .standard = wavelan_handler,
2376 .private = wavelan_private_handler,
2377 .private_args = wavelan_private_args,
2378 .get_wireless_stats = wavelan_get_wireless_stats,
2381 /*------------------------------------------------------------------*/
2383 * Get wireless statistics.
2384 * Called by /proc/net/wireless
2386 static iw_stats *wavelan_get_wireless_stats(struct net_device * dev)
2388 unsigned long ioaddr = dev->base_addr;
2389 net_local *lp = (net_local *) dev->priv;
2392 unsigned long flags;
2394 #ifdef DEBUG_IOCTL_TRACE
2395 printk(KERN_DEBUG "%s: ->wavelan_get_wireless_stats()\n",
2400 if (lp == (net_local *) NULL)
2401 return (iw_stats *) NULL;
2403 /* Disable interrupts and save flags. */
2404 spin_lock_irqsave(&lp->spinlock, flags);
2406 wstats = &lp->wstats;
2408 /* Get data from the mmc. */
2409 mmc_out(ioaddr, mmwoff(0, mmw_freeze), 1);
2411 mmc_read(ioaddr, mmroff(0, mmr_dce_status), &m.mmr_dce_status, 1);
2412 mmc_read(ioaddr, mmroff(0, mmr_wrong_nwid_l), &m.mmr_wrong_nwid_l,
2414 mmc_read(ioaddr, mmroff(0, mmr_thr_pre_set), &m.mmr_thr_pre_set,
2417 mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0);
2419 /* Copy data to wireless stuff. */
2420 wstats->status = m.mmr_dce_status & MMR_DCE_STATUS;
2421 wstats->qual.qual = m.mmr_sgnl_qual & MMR_SGNL_QUAL;
2422 wstats->qual.level = m.mmr_signal_lvl & MMR_SIGNAL_LVL;
2423 wstats->qual.noise = m.mmr_silence_lvl & MMR_SILENCE_LVL;
2424 wstats->qual.updated = (((m. mmr_signal_lvl & MMR_SIGNAL_LVL_VALID) >> 7)
2425 | ((m.mmr_signal_lvl & MMR_SIGNAL_LVL_VALID) >> 6)
2426 | ((m.mmr_silence_lvl & MMR_SILENCE_LVL_VALID) >> 5));
2427 wstats->discard.nwid += (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l;
2428 wstats->discard.code = 0L;
2429 wstats->discard.misc = 0L;
2431 /* Enable interrupts and restore flags. */
2432 spin_unlock_irqrestore(&lp->spinlock, flags);
2434 #ifdef DEBUG_IOCTL_TRACE
2435 printk(KERN_DEBUG "%s: <-wavelan_get_wireless_stats()\n",
2441 /************************* PACKET RECEPTION *************************/
2443 * This part deals with receiving the packets.
2444 * The interrupt handler gets an interrupt when a packet has been
2445 * successfully received and calls this part.
2448 /*------------------------------------------------------------------*/
2450 * This routine does the actual copying of data (including the Ethernet
2451 * header structure) from the WaveLAN card to an sk_buff chain that
2452 * will be passed up to the network interface layer. NOTE: we
2453 * currently don't handle trailer protocols (neither does the rest of
2454 * the network interface), so if that is needed, it will (at least in
2455 * part) be added here. The contents of the receive ring buffer are
2456 * copied to a message chain that is then passed to the kernel.
2458 * Note: if any errors occur, the packet is "dropped on the floor".
2459 * (called by wv_packet_rcv())
2462 wv_packet_read(struct net_device * dev, u16 buf_off, int sksize)
2464 net_local *lp = (net_local *) dev->priv;
2465 unsigned long ioaddr = dev->base_addr;
2466 struct sk_buff *skb;
2468 #ifdef DEBUG_RX_TRACE
2469 printk(KERN_DEBUG "%s: ->wv_packet_read(0x%X, %d)\n",
2470 dev->name, buf_off, sksize);
2473 /* Allocate buffer for the data */
2474 if ((skb = dev_alloc_skb(sksize)) == (struct sk_buff *) NULL) {
2475 #ifdef DEBUG_RX_ERROR
2477 "%s: wv_packet_read(): could not alloc_skb(%d, GFP_ATOMIC).\n",
2480 lp->stats.rx_dropped++;
2484 /* Copy the packet to the buffer. */
2485 obram_read(ioaddr, buf_off, skb_put(skb, sksize), sksize);
2486 skb->protocol = eth_type_trans(skb, dev);
2488 #ifdef DEBUG_RX_INFO
2489 wv_packet_info(skb_mac_header(skb), sksize, dev->name,
2491 #endif /* DEBUG_RX_INFO */
2493 /* Statistics-gathering and associated stuff.
2494 * It seem a bit messy with all the define, but it's really
2497 #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */
2498 (lp->spy_data.spy_number > 0) ||
2499 #endif /* IW_WIRELESS_SPY */
2501 (lp->his_number > 0) ||
2502 #endif /* HISTOGRAM */
2504 u8 stats[3]; /* signal level, noise level, signal quality */
2506 /* Read signal level, silence level and signal quality bytes */
2507 /* Note: in the PCMCIA hardware, these are part of the frame.
2508 * It seems that for the ISA hardware, it's nowhere to be
2509 * found in the frame, so I'm obliged to do this (it has a
2510 * side effect on /proc/net/wireless).
2513 mmc_out(ioaddr, mmwoff(0, mmw_freeze), 1);
2514 mmc_read(ioaddr, mmroff(0, mmr_signal_lvl), stats, 3);
2515 mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0);
2517 #ifdef DEBUG_RX_INFO
2519 "%s: wv_packet_read(): Signal level %d/63, Silence level %d/63, signal quality %d/16\n",
2520 dev->name, stats[0] & 0x3F, stats[1] & 0x3F,
2525 #ifdef IW_WIRELESS_SPY
2526 wl_spy_gather(dev, skb_mac_header(skb) + WAVELAN_ADDR_SIZE,
2528 #endif /* IW_WIRELESS_SPY */
2530 wl_his_gather(dev, stats);
2531 #endif /* HISTOGRAM */
2535 * Hand the packet to the network module.
2539 /* Keep statistics up to date */
2540 dev->last_rx = jiffies;
2541 lp->stats.rx_packets++;
2542 lp->stats.rx_bytes += sksize;
2544 #ifdef DEBUG_RX_TRACE
2545 printk(KERN_DEBUG "%s: <-wv_packet_read()\n", dev->name);
2549 /*------------------------------------------------------------------*/
2551 * Transfer as many packets as we can
2552 * from the device RAM.
2553 * (called in wavelan_interrupt()).
2554 * Note : the spinlock is already grabbed for us.
2556 static void wv_receive(struct net_device * dev)
2558 unsigned long ioaddr = dev->base_addr;
2559 net_local *lp = (net_local *) dev->priv;
2564 #ifdef DEBUG_RX_TRACE
2565 printk(KERN_DEBUG "%s: ->wv_receive()\n", dev->name);
2568 /* Loop on each received packet. */
2570 obram_read(ioaddr, lp->rx_head, (unsigned char *) &fd,
2573 /* Note about the status :
2574 * It start up to be 0 (the value we set). Then, when the RU
2575 * grab the buffer to prepare for reception, it sets the
2576 * FD_STATUS_B flag. When the RU has finished receiving the
2577 * frame, it clears FD_STATUS_B, set FD_STATUS_C to indicate
2578 * completion and set the other flags to indicate the eventual
2579 * errors. FD_STATUS_OK indicates that the reception was OK.
2582 /* If the current frame is not complete, we have reached the end. */
2583 if ((fd.fd_status & FD_STATUS_C) != FD_STATUS_C)
2584 break; /* This is how we exit the loop. */
2588 /* Check whether frame was correctly received. */
2589 if ((fd.fd_status & FD_STATUS_OK) == FD_STATUS_OK) {
2590 /* Does the frame contain a pointer to the data? Let's check. */
2591 if (fd.fd_rbd_offset != I82586NULL) {
2592 /* Read the receive buffer descriptor */
2593 obram_read(ioaddr, fd.fd_rbd_offset,
2594 (unsigned char *) &rbd,
2597 #ifdef DEBUG_RX_ERROR
2598 if ((rbd.rbd_status & RBD_STATUS_EOF) !=
2599 RBD_STATUS_EOF) printk(KERN_INFO
2600 "%s: wv_receive(): missing EOF flag.\n",
2603 if ((rbd.rbd_status & RBD_STATUS_F) !=
2604 RBD_STATUS_F) printk(KERN_INFO
2605 "%s: wv_receive(): missing F flag.\n",
2607 #endif /* DEBUG_RX_ERROR */
2609 /* Read the packet and transmit to Linux */
2610 wv_packet_read(dev, rbd.rbd_bufl,
2615 #ifdef DEBUG_RX_ERROR
2616 else /* if frame has no data */
2618 "%s: wv_receive(): frame has no data.\n",
2621 } else { /* If reception was no successful */
2623 lp->stats.rx_errors++;
2625 #ifdef DEBUG_RX_INFO
2627 "%s: wv_receive(): frame not received successfully (%X).\n",
2628 dev->name, fd.fd_status);
2631 #ifdef DEBUG_RX_ERROR
2632 if ((fd.fd_status & FD_STATUS_S6) != 0)
2634 "%s: wv_receive(): no EOF flag.\n",
2638 if ((fd.fd_status & FD_STATUS_S7) != 0) {
2639 lp->stats.rx_length_errors++;
2640 #ifdef DEBUG_RX_FAIL
2642 "%s: wv_receive(): frame too short.\n",
2647 if ((fd.fd_status & FD_STATUS_S8) != 0) {
2648 lp->stats.rx_over_errors++;
2649 #ifdef DEBUG_RX_FAIL
2651 "%s: wv_receive(): rx DMA overrun.\n",
2656 if ((fd.fd_status & FD_STATUS_S9) != 0) {
2657 lp->stats.rx_fifo_errors++;
2658 #ifdef DEBUG_RX_FAIL
2660 "%s: wv_receive(): ran out of resources.\n",
2665 if ((fd.fd_status & FD_STATUS_S10) != 0) {
2666 lp->stats.rx_frame_errors++;
2667 #ifdef DEBUG_RX_FAIL
2669 "%s: wv_receive(): alignment error.\n",
2674 if ((fd.fd_status & FD_STATUS_S11) != 0) {
2675 lp->stats.rx_crc_errors++;
2676 #ifdef DEBUG_RX_FAIL
2678 "%s: wv_receive(): CRC error.\n",
2685 obram_write(ioaddr, fdoff(lp->rx_head, fd_status),
2686 (unsigned char *) &fd.fd_status,
2687 sizeof(fd.fd_status));
2689 fd.fd_command = FD_COMMAND_EL;
2690 obram_write(ioaddr, fdoff(lp->rx_head, fd_command),
2691 (unsigned char *) &fd.fd_command,
2692 sizeof(fd.fd_command));
2695 obram_write(ioaddr, fdoff(lp->rx_last, fd_command),
2696 (unsigned char *) &fd.fd_command,
2697 sizeof(fd.fd_command));
2699 lp->rx_last = lp->rx_head;
2700 lp->rx_head = fd.fd_link_offset;
2701 } /* for(;;) -> loop on all frames */
2703 #ifdef DEBUG_RX_INFO
2705 printk(KERN_DEBUG "%s: wv_receive(): reaped %d\n",
2706 dev->name, nreaped);
2708 #ifdef DEBUG_RX_TRACE
2709 printk(KERN_DEBUG "%s: <-wv_receive()\n", dev->name);
2713 /*********************** PACKET TRANSMISSION ***********************/
2715 * This part deals with sending packets through the WaveLAN.
2719 /*------------------------------------------------------------------*/
2721 * This routine fills in the appropriate registers and memory
2722 * locations on the WaveLAN card and starts the card off on
2726 * Each block contains a transmit command, a NOP command,
2727 * a transmit block descriptor and a buffer.
2728 * The CU read the transmit block which point to the tbd,
2729 * read the tbd and the content of the buffer.
2730 * When it has finish with it, it goes to the next command
2731 * which in our case is the NOP. The NOP points on itself,
2732 * so the CU stop here.
2733 * When we add the next block, we modify the previous nop
2734 * to make it point on the new tx command.
2735 * Simple, isn't it ?
2737 * (called in wavelan_packet_xmit())
2739 static int wv_packet_write(struct net_device * dev, void *buf, short length)
2741 net_local *lp = (net_local *) dev->priv;
2742 unsigned long ioaddr = dev->base_addr;
2743 unsigned short txblock;
2744 unsigned short txpred;
2745 unsigned short tx_addr;
2746 unsigned short nop_addr;
2747 unsigned short tbd_addr;
2748 unsigned short buf_addr;
2753 unsigned long flags;
2755 #ifdef DEBUG_TX_TRACE
2756 printk(KERN_DEBUG "%s: ->wv_packet_write(%d)\n", dev->name,
2760 spin_lock_irqsave(&lp->spinlock, flags);
2762 /* Check nothing bad has happened */
2763 if (lp->tx_n_in_use == (NTXBLOCKS - 1)) {
2764 #ifdef DEBUG_TX_ERROR
2765 printk(KERN_INFO "%s: wv_packet_write(): Tx queue full.\n",
2768 spin_unlock_irqrestore(&lp->spinlock, flags);
2772 /* Calculate addresses of next block and previous block. */
2773 txblock = lp->tx_first_free;
2774 txpred = txblock - TXBLOCKZ;
2775 if (txpred < OFFSET_CU)
2776 txpred += NTXBLOCKS * TXBLOCKZ;
2777 lp->tx_first_free += TXBLOCKZ;
2778 if (lp->tx_first_free >= OFFSET_CU + NTXBLOCKS * TXBLOCKZ)
2779 lp->tx_first_free -= NTXBLOCKS * TXBLOCKZ;
2783 /* Calculate addresses of the different parts of the block. */
2785 nop_addr = tx_addr + sizeof(tx);
2786 tbd_addr = nop_addr + sizeof(nop);
2787 buf_addr = tbd_addr + sizeof(tbd);
2792 tx.tx_h.ac_status = 0;
2793 obram_write(ioaddr, toff(ac_tx_t, tx_addr, tx_h.ac_status),
2794 (unsigned char *) &tx.tx_h.ac_status,
2795 sizeof(tx.tx_h.ac_status));
2800 nop.nop_h.ac_status = 0;
2801 obram_write(ioaddr, toff(ac_nop_t, nop_addr, nop_h.ac_status),
2802 (unsigned char *) &nop.nop_h.ac_status,
2803 sizeof(nop.nop_h.ac_status));
2804 nop.nop_h.ac_link = nop_addr;
2805 obram_write(ioaddr, toff(ac_nop_t, nop_addr, nop_h.ac_link),
2806 (unsigned char *) &nop.nop_h.ac_link,
2807 sizeof(nop.nop_h.ac_link));
2810 * Transmit buffer descriptor
2812 tbd.tbd_status = TBD_STATUS_EOF | (TBD_STATUS_ACNT & clen);
2813 tbd.tbd_next_bd_offset = I82586NULL;
2814 tbd.tbd_bufl = buf_addr;
2816 obram_write(ioaddr, tbd_addr, (unsigned char *) &tbd, sizeof(tbd));
2821 obram_write(ioaddr, buf_addr, buf, length);
2824 * Overwrite the predecessor NOP link
2825 * so that it points to this txblock.
2827 nop_addr = txpred + sizeof(tx);
2828 nop.nop_h.ac_status = 0;
2829 obram_write(ioaddr, toff(ac_nop_t, nop_addr, nop_h.ac_status),
2830 (unsigned char *) &nop.nop_h.ac_status,
2831 sizeof(nop.nop_h.ac_status));
2832 nop.nop_h.ac_link = txblock;
2833 obram_write(ioaddr, toff(ac_nop_t, nop_addr, nop_h.ac_link),
2834 (unsigned char *) &nop.nop_h.ac_link,
2835 sizeof(nop.nop_h.ac_link));
2837 /* Make sure the watchdog will keep quiet for a while */
2838 dev->trans_start = jiffies;
2840 /* Keep stats up to date. */
2841 lp->stats.tx_bytes += length;
2843 if (lp->tx_first_in_use == I82586NULL)
2844 lp->tx_first_in_use = txblock;
2846 if (lp->tx_n_in_use < NTXBLOCKS - 1)
2847 netif_wake_queue(dev);
2849 spin_unlock_irqrestore(&lp->spinlock, flags);
2851 #ifdef DEBUG_TX_INFO
2852 wv_packet_info((u8 *) buf, length, dev->name,
2854 #endif /* DEBUG_TX_INFO */
2856 #ifdef DEBUG_TX_TRACE
2857 printk(KERN_DEBUG "%s: <-wv_packet_write()\n", dev->name);
2863 /*------------------------------------------------------------------*/
2865 * This routine is called when we want to send a packet (NET3 callback)
2866 * In this routine, we check if the harware is ready to accept
2867 * the packet. We also prevent reentrance. Then we call the function
2868 * to send the packet.
2870 static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev)
2872 net_local *lp = (net_local *) dev->priv;
2873 unsigned long flags;
2874 char data[ETH_ZLEN];
2876 #ifdef DEBUG_TX_TRACE
2877 printk(KERN_DEBUG "%s: ->wavelan_packet_xmit(0x%X)\n", dev->name,
2882 * Block a timer-based transmit from overlapping.
2883 * In other words, prevent reentering this routine.
2885 netif_stop_queue(dev);
2887 /* If somebody has asked to reconfigure the controller,
2890 if (lp->reconfig_82586) {
2891 spin_lock_irqsave(&lp->spinlock, flags);
2892 wv_82586_config(dev);
2893 spin_unlock_irqrestore(&lp->spinlock, flags);
2894 /* Check that we can continue */
2895 if (lp->tx_n_in_use == (NTXBLOCKS - 1))
2898 #ifdef DEBUG_TX_ERROR
2900 printk(KERN_INFO "skb has next\n");
2903 /* Do we need some padding? */
2904 /* Note : on wireless the propagation time is in the order of 1us,
2905 * and we don't have the Ethernet specific requirement of beeing
2906 * able to detect collisions, therefore in theory we don't really
2907 * need to pad. Jean II */
2908 if (skb->len < ETH_ZLEN) {
2909 memset(data, 0, ETH_ZLEN);
2910 skb_copy_from_linear_data(skb, data, skb->len);
2911 /* Write packet on the card */
2912 if(wv_packet_write(dev, data, ETH_ZLEN))
2913 return 1; /* We failed */
2915 else if(wv_packet_write(dev, skb->data, skb->len))
2916 return 1; /* We failed */
2921 #ifdef DEBUG_TX_TRACE
2922 printk(KERN_DEBUG "%s: <-wavelan_packet_xmit()\n", dev->name);
2927 /*********************** HARDWARE CONFIGURATION ***********************/
2929 * This part does the real job of starting and configuring the hardware.
2932 /*--------------------------------------------------------------------*/
2934 * Routine to initialize the Modem Management Controller.
2935 * (called by wv_hw_reset())
2937 static int wv_mmc_init(struct net_device * dev)
2939 unsigned long ioaddr = dev->base_addr;
2940 net_local *lp = (net_local *) dev->priv;
2945 #ifdef DEBUG_CONFIG_TRACE
2946 printk(KERN_DEBUG "%s: ->wv_mmc_init()\n", dev->name);
2949 /* Read the parameter storage area. */
2950 psa_read(ioaddr, lp->hacr, 0, (unsigned char *) &psa, sizeof(psa));
2952 #ifdef USE_PSA_CONFIG
2953 configured = psa.psa_conf_status & 1;
2958 /* Is the PSA is not configured */
2960 /* User will be able to configure NWID later (with iwconfig). */
2961 psa.psa_nwid[0] = 0;
2962 psa.psa_nwid[1] = 0;
2964 /* no NWID checking since NWID is not set */
2965 psa.psa_nwid_select = 0;
2967 /* Disable encryption */
2968 psa.psa_encryption_select = 0;
2970 /* Set to standard values:
2973 * 0x04 for PCMCIA and 2.00 card (AT&T 407-024689/E document)
2975 if (psa.psa_comp_number & 1)
2976 psa.psa_thr_pre_set = 0x01;
2978 psa.psa_thr_pre_set = 0x04;
2979 psa.psa_quality_thr = 0x03;
2981 /* It is configured */
2982 psa.psa_conf_status |= 1;
2984 #ifdef USE_PSA_CONFIG
2985 /* Write the psa. */
2986 psa_write(ioaddr, lp->hacr,
2987 (char *) psa.psa_nwid - (char *) &psa,
2988 (unsigned char *) psa.psa_nwid, 4);
2989 psa_write(ioaddr, lp->hacr,
2990 (char *) &psa.psa_thr_pre_set - (char *) &psa,
2991 (unsigned char *) &psa.psa_thr_pre_set, 1);
2992 psa_write(ioaddr, lp->hacr,
2993 (char *) &psa.psa_quality_thr - (char *) &psa,
2994 (unsigned char *) &psa.psa_quality_thr, 1);
2995 psa_write(ioaddr, lp->hacr,
2996 (char *) &psa.psa_conf_status - (char *) &psa,
2997 (unsigned char *) &psa.psa_conf_status, 1);
2998 /* update the Wavelan checksum */
2999 update_psa_checksum(dev, ioaddr, lp->hacr);
3003 /* Zero the mmc structure. */
3004 memset(&m, 0x00, sizeof(m));
3006 /* Copy PSA info to the mmc. */
3007 m.mmw_netw_id_l = psa.psa_nwid[1];
3008 m.mmw_netw_id_h = psa.psa_nwid[0];
3010 if (psa.psa_nwid_select & 1)
3011 m.mmw_loopt_sel = 0x00;
3013 m.mmw_loopt_sel = MMW_LOOPT_SEL_DIS_NWID;
3015 memcpy(&m.mmw_encr_key, &psa.psa_encryption_key,
3016 sizeof(m.mmw_encr_key));
3018 if (psa.psa_encryption_select)
3020 MMW_ENCR_ENABLE_EN | MMW_ENCR_ENABLE_MODE;
3022 m.mmw_encr_enable = 0;
3024 m.mmw_thr_pre_set = psa.psa_thr_pre_set & 0x3F;
3025 m.mmw_quality_thr = psa.psa_quality_thr & 0x0F;
3028 * Set default modem control parameters.
3029 * See NCR document 407-0024326 Rev. A.
3031 m.mmw_jabber_enable = 0x01;
3033 m.mmw_anten_sel = MMW_ANTEN_SEL_ALG_EN;
3035 m.mmw_mod_delay = 0x04;
3036 m.mmw_jam_time = 0x38;
3038 m.mmw_des_io_invert = 0;
3039 m.mmw_decay_prm = 0;
3040 m.mmw_decay_updat_prm = 0;
3042 /* Write all info to MMC. */
3043 mmc_write(ioaddr, 0, (u8 *) & m, sizeof(m));
3045 /* The following code starts the modem of the 2.00 frequency
3046 * selectable cards at power on. It's not strictly needed for the
3048 * The original patch was by Joe Finney for the PCMCIA driver, but
3049 * I've cleaned it up a bit and added documentation.
3050 * Thanks to Loeke Brederveld from Lucent for the info.
3053 /* Attempt to recognise 2.00 cards (2.4 GHz frequency selectable)
3054 * Does it work for everybody, especially old cards? */
3055 /* Note: WFREQSEL verifies that it is able to read a sensible
3056 * frequency from EEPROM (address 0x00) and that MMR_FEE_STATUS_ID
3057 * is 0xA (Xilinx version) or 0xB (Ariadne version).
3058 * My test is more crude but does work. */
3059 if (!(mmc_in(ioaddr, mmroff(0, mmr_fee_status)) &
3060 (MMR_FEE_STATUS_DWLD | MMR_FEE_STATUS_BUSY))) {
3061 /* We must download the frequency parameters to the
3062 * synthesizers (from the EEPROM - area 1)
3063 * Note: as the EEPROM is automatically decremented, we set the end
3065 m.mmw_fee_addr = 0x0F;
3066 m.mmw_fee_ctrl = MMW_FEE_CTRL_READ | MMW_FEE_CTRL_DWLD;
3067 mmc_write(ioaddr, (char *) &m.mmw_fee_ctrl - (char *) &m,
3068 (unsigned char *) &m.mmw_fee_ctrl, 2);
3070 /* Wait until the download is finished. */
3071 fee_wait(ioaddr, 100, 100);
3073 #ifdef DEBUG_CONFIG_INFO
3074 /* The frequency was in the last word downloaded. */
3075 mmc_read(ioaddr, (char *) &m.mmw_fee_data_l - (char *) &m,
3076 (unsigned char *) &m.mmw_fee_data_l, 2);
3078 /* Print some info for the user. */
3080 "%s: WaveLAN 2.00 recognised (frequency select). Current frequency = %ld\n",
3083 mmw_fee_data_h << 4) | (m.mmw_fee_data_l >> 4)) *
3087 /* We must now download the power adjust value (gain) to
3088 * the synthesizers (from the EEPROM - area 7 - DAC). */
3089 m.mmw_fee_addr = 0x61;
3090 m.mmw_fee_ctrl = MMW_FEE_CTRL_READ | MMW_FEE_CTRL_DWLD;
3091 mmc_write(ioaddr, (char *) &m.mmw_fee_ctrl - (char *) &m,
3092 (unsigned char *) &m.mmw_fee_ctrl, 2);
3094 /* Wait until the download is finished. */
3097 #ifdef DEBUG_CONFIG_TRACE
3098 printk(KERN_DEBUG "%s: <-wv_mmc_init()\n", dev->name);
3103 /*------------------------------------------------------------------*/
3105 * Construct the fd and rbd structures.
3106 * Start the receive unit.
3107 * (called by wv_hw_reset())
3109 static int wv_ru_start(struct net_device * dev)
3111 net_local *lp = (net_local *) dev->priv;
3112 unsigned long ioaddr = dev->base_addr;
3120 #ifdef DEBUG_CONFIG_TRACE
3121 printk(KERN_DEBUG "%s: ->wv_ru_start()\n", dev->name);
3124 obram_read(ioaddr, scboff(OFFSET_SCB, scb_status),
3125 (unsigned char *) &scb_cs, sizeof(scb_cs));
3126 if ((scb_cs & SCB_ST_RUS) == SCB_ST_RUS_RDY)
3129 lp->rx_head = OFFSET_RU;
3131 for (i = 0, rx = lp->rx_head; i < NRXBLOCKS; i++, rx = rx_next) {
3133 (i == NRXBLOCKS - 1) ? lp->rx_head : rx + RXBLOCKZ;
3136 fd.fd_command = (i == NRXBLOCKS - 1) ? FD_COMMAND_EL : 0;
3137 fd.fd_link_offset = rx_next;
3138 fd.fd_rbd_offset = rx + sizeof(fd);
3139 obram_write(ioaddr, rx, (unsigned char *) &fd, sizeof(fd));
3142 rbd.rbd_next_rbd_offset = I82586NULL;
3143 rbd.rbd_bufl = rx + sizeof(fd) + sizeof(rbd);
3145 rbd.rbd_el_size = RBD_EL | (RBD_SIZE & MAXDATAZ);
3146 obram_write(ioaddr, rx + sizeof(fd),
3147 (unsigned char *) &rbd, sizeof(rbd));
3152 obram_write(ioaddr, scboff(OFFSET_SCB, scb_rfa_offset),
3153 (unsigned char *) &lp->rx_head, sizeof(lp->rx_head));
3155 scb_cs = SCB_CMD_RUC_GO;
3156 obram_write(ioaddr, scboff(OFFSET_SCB, scb_command),
3157 (unsigned char *) &scb_cs, sizeof(scb_cs));
3159 set_chan_attn(ioaddr, lp->hacr);
3161 for (i = 1000; i > 0; i--) {
3162 obram_read(ioaddr, scboff(OFFSET_SCB, scb_command),
3163 (unsigned char *) &scb_cs, sizeof(scb_cs));
3171 #ifdef DEBUG_CONFIG_ERROR
3173 "%s: wavelan_ru_start(): board not accepting command.\n",
3178 #ifdef DEBUG_CONFIG_TRACE
3179 printk(KERN_DEBUG "%s: <-wv_ru_start()\n", dev->name);
3184 /*------------------------------------------------------------------*/
3186 * Initialise the transmit blocks.
3187 * Start the command unit executing the NOP
3188 * self-loop of the first transmit block.
3190 * Here we create the list of send buffers used to transmit packets
3191 * between the PC and the command unit. For each buffer, we create a
3192 * buffer descriptor (pointing on the buffer), a transmit command
3193 * (pointing to the buffer descriptor) and a NOP command.
3194 * The transmit command is linked to the NOP, and the NOP to itself.
3195 * When we will have finished executing the transmit command, we will
3196 * then loop on the NOP. By releasing the NOP link to a new command,
3197 * we may send another buffer.
3199 * (called by wv_hw_reset())
3201 static int wv_cu_start(struct net_device * dev)
3203 net_local *lp = (net_local *) dev->priv;
3204 unsigned long ioaddr = dev->base_addr;
3210 #ifdef DEBUG_CONFIG_TRACE
3211 printk(KERN_DEBUG "%s: ->wv_cu_start()\n", dev->name);
3214 lp->tx_first_free = OFFSET_CU;
3215 lp->tx_first_in_use = I82586NULL;
3217 for (i = 0, txblock = OFFSET_CU;
3218 i < NTXBLOCKS; i++, txblock += TXBLOCKZ) {
3222 unsigned short tx_addr;
3223 unsigned short nop_addr;
3224 unsigned short tbd_addr;
3225 unsigned short buf_addr;
3228 nop_addr = tx_addr + sizeof(tx);
3229 tbd_addr = nop_addr + sizeof(nop);
3230 buf_addr = tbd_addr + sizeof(tbd);
3232 tx.tx_h.ac_status = 0;
3233 tx.tx_h.ac_command = acmd_transmit | AC_CFLD_I;
3234 tx.tx_h.ac_link = nop_addr;
3235 tx.tx_tbd_offset = tbd_addr;
3236 obram_write(ioaddr, tx_addr, (unsigned char *) &tx,
3239 nop.nop_h.ac_status = 0;
3240 nop.nop_h.ac_command = acmd_nop;
3241 nop.nop_h.ac_link = nop_addr;
3242 obram_write(ioaddr, nop_addr, (unsigned char *) &nop,
3245 tbd.tbd_status = TBD_STATUS_EOF;
3246 tbd.tbd_next_bd_offset = I82586NULL;
3247 tbd.tbd_bufl = buf_addr;
3249 obram_write(ioaddr, tbd_addr, (unsigned char *) &tbd,
3254 OFFSET_CU + (NTXBLOCKS - 1) * TXBLOCKZ + sizeof(ac_tx_t);
3255 obram_write(ioaddr, scboff(OFFSET_SCB, scb_cbl_offset),
3256 (unsigned char *) &first_nop, sizeof(first_nop));
3258 scb_cs = SCB_CMD_CUC_GO;
3259 obram_write(ioaddr, scboff(OFFSET_SCB, scb_command),
3260 (unsigned char *) &scb_cs, sizeof(scb_cs));
3262 set_chan_attn(ioaddr, lp->hacr);
3264 for (i = 1000; i > 0; i--) {
3265 obram_read(ioaddr, scboff(OFFSET_SCB, scb_command),
3266 (unsigned char *) &scb_cs, sizeof(scb_cs));
3274 #ifdef DEBUG_CONFIG_ERROR
3276 "%s: wavelan_cu_start(): board not accepting command.\n",
3282 lp->tx_n_in_use = 0;
3283 netif_start_queue(dev);
3284 #ifdef DEBUG_CONFIG_TRACE
3285 printk(KERN_DEBUG "%s: <-wv_cu_start()\n", dev->name);
3290 /*------------------------------------------------------------------*/
3292 * This routine does a standard configuration of the WaveLAN
3293 * controller (i82586).
3295 * It initialises the scp, iscp and scb structure
3296 * The first two are just pointers to the next.
3297 * The last one is used for basic configuration and for basic
3298 * communication (interrupt status).
3300 * (called by wv_hw_reset())
3302 static int wv_82586_start(struct net_device * dev)
3304 net_local *lp = (net_local *) dev->priv;
3305 unsigned long ioaddr = dev->base_addr;
3306 scp_t scp; /* system configuration pointer */
3307 iscp_t iscp; /* intermediate scp */
3308 scb_t scb; /* system control block */
3309 ach_t cb; /* Action command header */
3313 #ifdef DEBUG_CONFIG_TRACE
3314 printk(KERN_DEBUG "%s: ->wv_82586_start()\n", dev->name);
3318 * Clear the onboard RAM.
3320 memset(&zeroes[0], 0x00, sizeof(zeroes));
3321 for (i = 0; i < I82586_MEMZ; i += sizeof(zeroes))
3322 obram_write(ioaddr, i, &zeroes[0], sizeof(zeroes));
3325 * Construct the command unit structures:
3326 * scp, iscp, scb, cb.
3328 memset(&scp, 0x00, sizeof(scp));
3329 scp.scp_sysbus = SCP_SY_16BBUS;
3330 scp.scp_iscpl = OFFSET_ISCP;
3331 obram_write(ioaddr, OFFSET_SCP, (unsigned char *) &scp,
3334 memset(&iscp, 0x00, sizeof(iscp));
3336 iscp.iscp_offset = OFFSET_SCB;
3337 obram_write(ioaddr, OFFSET_ISCP, (unsigned char *) &iscp,
3340 /* Our first command is to reset the i82586. */
3341 memset(&scb, 0x00, sizeof(scb));
3342 scb.scb_command = SCB_CMD_RESET;
3343 scb.scb_cbl_offset = OFFSET_CU;
3344 scb.scb_rfa_offset = OFFSET_RU;
3345 obram_write(ioaddr, OFFSET_SCB, (unsigned char *) &scb,
3348 set_chan_attn(ioaddr, lp->hacr);
3350 /* Wait for command to finish. */
3351 for (i = 1000; i > 0; i--) {
3352 obram_read(ioaddr, OFFSET_ISCP, (unsigned char *) &iscp,
3355 if (iscp.iscp_busy == (unsigned short) 0)
3362 #ifdef DEBUG_CONFIG_ERROR
3364 "%s: wv_82586_start(): iscp_busy timeout.\n",
3370 /* Check command completion. */
3371 for (i = 15; i > 0; i--) {
3372 obram_read(ioaddr, OFFSET_SCB, (unsigned char *) &scb,
3375 if (scb.scb_status == (SCB_ST_CX | SCB_ST_CNA))
3382 #ifdef DEBUG_CONFIG_ERROR
3384 "%s: wv_82586_start(): status: expected 0x%02x, got 0x%02x.\n",
3385 dev->name, SCB_ST_CX | SCB_ST_CNA, scb.scb_status);
3392 /* Set the action command header. */
3393 memset(&cb, 0x00, sizeof(cb));
3394 cb.ac_command = AC_CFLD_EL | (AC_CFLD_CMD & acmd_diagnose);
3395 cb.ac_link = OFFSET_CU;
3396 obram_write(ioaddr, OFFSET_CU, (unsigned char *) &cb, sizeof(cb));
3398 if (wv_synchronous_cmd(dev, "diag()") == -1)
3401 obram_read(ioaddr, OFFSET_CU, (unsigned char *) &cb, sizeof(cb));
3402 if (cb.ac_status & AC_SFLD_FAIL) {
3403 #ifdef DEBUG_CONFIG_ERROR
3405 "%s: wv_82586_start(): i82586 Self Test failed.\n",
3410 #ifdef DEBUG_I82586_SHOW
3411 wv_scb_show(ioaddr);
3414 #ifdef DEBUG_CONFIG_TRACE
3415 printk(KERN_DEBUG "%s: <-wv_82586_start()\n", dev->name);
3420 /*------------------------------------------------------------------*/
3422 * This routine does a standard configuration of the WaveLAN
3423 * controller (i82586).
3425 * This routine is a violent hack. We use the first free transmit block
3426 * to make our configuration. In the buffer area, we create the three
3427 * configuration commands (linked). We make the previous NOP point to
3428 * the beginning of the buffer instead of the tx command. After, we go
3429 * as usual to the NOP command.
3430 * Note that only the last command (mc_set) will generate an interrupt.
3432 * (called by wv_hw_reset(), wv_82586_reconfig(), wavelan_packet_xmit())
3434 static void wv_82586_config(struct net_device * dev)
3436 net_local *lp = (net_local *) dev->priv;
3437 unsigned long ioaddr = dev->base_addr;
3438 unsigned short txblock;
3439 unsigned short txpred;
3440 unsigned short tx_addr;
3441 unsigned short nop_addr;
3442 unsigned short tbd_addr;
3443 unsigned short cfg_addr;
3444 unsigned short ias_addr;
3445 unsigned short mcs_addr;
3448 ac_cfg_t cfg; /* Configure action */
3449 ac_ias_t ias; /* IA-setup action */
3450 ac_mcs_t mcs; /* Multicast setup */
3451 struct dev_mc_list *dmi;
3453 #ifdef DEBUG_CONFIG_TRACE
3454 printk(KERN_DEBUG "%s: ->wv_82586_config()\n", dev->name);
3457 /* Check nothing bad has happened */
3458 if (lp->tx_n_in_use == (NTXBLOCKS - 1)) {
3459 #ifdef DEBUG_CONFIG_ERROR
3460 printk(KERN_INFO "%s: wv_82586_config(): Tx queue full.\n",
3466 /* Calculate addresses of next block and previous block. */
3467 txblock = lp->tx_first_free;
3468 txpred = txblock - TXBLOCKZ;
3469 if (txpred < OFFSET_CU)
3470 txpred += NTXBLOCKS * TXBLOCKZ;
3471 lp->tx_first_free += TXBLOCKZ;
3472 if (lp->tx_first_free >= OFFSET_CU + NTXBLOCKS * TXBLOCKZ)
3473 lp->tx_first_free -= NTXBLOCKS * TXBLOCKZ;
3477 /* Calculate addresses of the different parts of the block. */
3479 nop_addr = tx_addr + sizeof(tx);
3480 tbd_addr = nop_addr + sizeof(nop);
3481 cfg_addr = tbd_addr + sizeof(tbd_t); /* beginning of the buffer */
3482 ias_addr = cfg_addr + sizeof(cfg);
3483 mcs_addr = ias_addr + sizeof(ias);
3488 tx.tx_h.ac_status = 0xFFFF; /* Fake completion value */
3489 obram_write(ioaddr, toff(ac_tx_t, tx_addr, tx_h.ac_status),
3490 (unsigned char *) &tx.tx_h.ac_status,
3491 sizeof(tx.tx_h.ac_status));
3496 nop.nop_h.ac_status = 0;
3497 obram_write(ioaddr, toff(ac_nop_t, nop_addr, nop_h.ac_status),
3498 (unsigned char *) &nop.nop_h.ac_status,
3499 sizeof(nop.nop_h.ac_status));
3500 nop.nop_h.ac_link = nop_addr;
3501 obram_write(ioaddr, toff(ac_nop_t, nop_addr, nop_h.ac_link),
3502 (unsigned char *) &nop.nop_h.ac_link,
3503 sizeof(nop.nop_h.ac_link));
3505 /* Create a configure action. */
3506 memset(&cfg, 0x00, sizeof(cfg));
3509 * For Linux we invert AC_CFG_ALOC() so as to conform
3510 * to the way that net packets reach us from above.
3511 * (See also ac_tx_t.)
3513 * Updated from Wavelan Manual WCIN085B
3516 AC_CFG_BYTE_CNT(sizeof(ac_cfg_t) - sizeof(ach_t));
3517 cfg.cfg_fifolim = AC_CFG_FIFOLIM(4);
3518 cfg.cfg_byte8 = AC_CFG_SAV_BF(1) | AC_CFG_SRDY(0);
3519 cfg.cfg_byte9 = AC_CFG_ELPBCK(0) |
3521 AC_CFG_PRELEN(AC_CFG_PLEN_2) |
3522 AC_CFG_ALOC(1) | AC_CFG_ADDRLEN(WAVELAN_ADDR_SIZE);
3523 cfg.cfg_byte10 = AC_CFG_BOFMET(1) |
3524 AC_CFG_ACR(6) | AC_CFG_LINPRIO(0);
3526 cfg.cfg_slotl = 0x0C;
3527 cfg.cfg_byte13 = AC_CFG_RETRYNUM(15) | AC_CFG_SLTTMHI(0);
3528 cfg.cfg_byte14 = AC_CFG_FLGPAD(0) |
3534 AC_CFG_BCDIS(0) | AC_CFG_PRM(lp->promiscuous);
3535 cfg.cfg_byte15 = AC_CFG_ICDS(0) |
3536 AC_CFG_CDTF(0) | AC_CFG_ICSS(0) | AC_CFG_CSTF(0);
3538 cfg.cfg_min_frm_len = AC_CFG_MNFRM(64);
3540 cfg.cfg_min_frm_len = AC_CFG_MNFRM(8);
3542 cfg.cfg_h.ac_command = (AC_CFLD_CMD & acmd_configure);
3543 cfg.cfg_h.ac_link = ias_addr;
3544 obram_write(ioaddr, cfg_addr, (unsigned char *) &cfg, sizeof(cfg));
3546 /* Set up the MAC address */
3547 memset(&ias, 0x00, sizeof(ias));
3548 ias.ias_h.ac_command = (AC_CFLD_CMD & acmd_ia_setup);
3549 ias.ias_h.ac_link = mcs_addr;
3550 memcpy(&ias.ias_addr[0], (unsigned char *) &dev->dev_addr[0],
3551 sizeof(ias.ias_addr));
3552 obram_write(ioaddr, ias_addr, (unsigned char *) &ias, sizeof(ias));
3554 /* Initialize adapter's Ethernet multicast addresses */
3555 memset(&mcs, 0x00, sizeof(mcs));
3556 mcs.mcs_h.ac_command = AC_CFLD_I | (AC_CFLD_CMD & acmd_mc_setup);
3557 mcs.mcs_h.ac_link = nop_addr;
3558 mcs.mcs_cnt = WAVELAN_ADDR_SIZE * lp->mc_count;
3559 obram_write(ioaddr, mcs_addr, (unsigned char *) &mcs, sizeof(mcs));
3561 /* Any address to set? */
3563 for (dmi = dev->mc_list; dmi; dmi = dmi->next)
3564 outsw(PIOP1(ioaddr), (u16 *) dmi->dmi_addr,
3565 WAVELAN_ADDR_SIZE >> 1);
3567 #ifdef DEBUG_CONFIG_INFO
3569 DECLARE_MAC_BUF(mac);
3571 "%s: wv_82586_config(): set %d multicast addresses:\n",
3572 dev->name, lp->mc_count);
3573 for (dmi = dev->mc_list; dmi; dmi = dmi->next)
3574 printk(KERN_DEBUG " %s\n",
3575 print_mac(mac, dmi->dmi_addr));
3581 * Overwrite the predecessor NOP link
3582 * so that it points to the configure action.
3584 nop_addr = txpred + sizeof(tx);
3585 nop.nop_h.ac_status = 0;
3586 obram_write(ioaddr, toff(ac_nop_t, nop_addr, nop_h.ac_status),
3587 (unsigned char *) &nop.nop_h.ac_status,
3588 sizeof(nop.nop_h.ac_status));
3589 nop.nop_h.ac_link = cfg_addr;
3590 obram_write(ioaddr, toff(ac_nop_t, nop_addr, nop_h.ac_link),
3591 (unsigned char *) &nop.nop_h.ac_link,
3592 sizeof(nop.nop_h.ac_link));
3594 /* Job done, clear the flag */
3595 lp->reconfig_82586 = 0;
3597 if (lp->tx_first_in_use == I82586NULL)
3598 lp->tx_first_in_use = txblock;
3600 if (lp->tx_n_in_use == (NTXBLOCKS - 1))
3601 netif_stop_queue(dev);
3603 #ifdef DEBUG_CONFIG_TRACE
3604 printk(KERN_DEBUG "%s: <-wv_82586_config()\n", dev->name);
3608 /*------------------------------------------------------------------*/
3610 * This routine, called by wavelan_close(), gracefully stops the
3611 * WaveLAN controller (i82586).
3612 * (called by wavelan_close())
3614 static void wv_82586_stop(struct net_device * dev)
3616 net_local *lp = (net_local *) dev->priv;
3617 unsigned long ioaddr = dev->base_addr;
3620 #ifdef DEBUG_CONFIG_TRACE
3621 printk(KERN_DEBUG "%s: ->wv_82586_stop()\n", dev->name);
3624 /* Suspend both command unit and receive unit. */
3626 (SCB_CMD_CUC & SCB_CMD_CUC_SUS) | (SCB_CMD_RUC &
3628 obram_write(ioaddr, scboff(OFFSET_SCB, scb_command),
3629 (unsigned char *) &scb_cmd, sizeof(scb_cmd));
3630 set_chan_attn(ioaddr, lp->hacr);
3632 /* No more interrupts */
3635 #ifdef DEBUG_CONFIG_TRACE
3636 printk(KERN_DEBUG "%s: <-wv_82586_stop()\n", dev->name);
3640 /*------------------------------------------------------------------*/
3642 * Totally reset the WaveLAN and restart it.
3643 * Performs the following actions:
3644 * 1. A power reset (reset DMA)
3645 * 2. Initialize the radio modem (using wv_mmc_init)
3646 * 3. Reset & Configure LAN controller (using wv_82586_start)
3647 * 4. Start the LAN controller's command unit
3648 * 5. Start the LAN controller's receive unit
3649 * (called by wavelan_interrupt(), wavelan_watchdog() & wavelan_open())
3651 static int wv_hw_reset(struct net_device * dev)
3653 net_local *lp = (net_local *) dev->priv;
3654 unsigned long ioaddr = dev->base_addr;
3656 #ifdef DEBUG_CONFIG_TRACE
3657 printk(KERN_DEBUG "%s: ->wv_hw_reset(dev=0x%x)\n", dev->name,
3658 (unsigned int) dev);
3661 /* Increase the number of resets done. */
3664 wv_hacr_reset(ioaddr);
3665 lp->hacr = HACR_DEFAULT;
3667 if ((wv_mmc_init(dev) < 0) || (wv_82586_start(dev) < 0))
3670 /* Enable the card to send interrupts. */
3673 /* Start card functions */
3674 if (wv_cu_start(dev) < 0)
3677 /* Setup the controller and parameters */
3678 wv_82586_config(dev);
3680 /* Finish configuration with the receive unit */
3681 if (wv_ru_start(dev) < 0)
3684 #ifdef DEBUG_CONFIG_TRACE
3685 printk(KERN_DEBUG "%s: <-wv_hw_reset()\n", dev->name);
3690 /*------------------------------------------------------------------*/
3692 * Check if there is a WaveLAN at the specific base address.
3693 * As a side effect, this reads the MAC address.
3694 * (called in wavelan_probe() and init_module())
3696 static int wv_check_ioaddr(unsigned long ioaddr, u8 * mac)
3698 int i; /* Loop counter */
3700 /* Check if the base address if available. */
3701 if (!request_region(ioaddr, sizeof(ha_t), "wavelan probe"))
3702 return -EBUSY; /* ioaddr already used */
3704 /* Reset host interface */
3705 wv_hacr_reset(ioaddr);
3707 /* Read the MAC address from the parameter storage area. */
3708 psa_read(ioaddr, HACR_DEFAULT, psaoff(0, psa_univ_mac_addr),
3711 release_region(ioaddr, sizeof(ha_t));
3714 * Check the first three octets of the address for the manufacturer's code.
3715 * Note: if this can't find your WaveLAN card, you've got a
3716 * non-NCR/AT&T/Lucent ISA card. See wavelan.p.h for detail on
3717 * how to configure your card.
3719 for (i = 0; i < ARRAY_SIZE(MAC_ADDRESSES); i++)
3720 if ((mac[0] == MAC_ADDRESSES[i][0]) &&
3721 (mac[1] == MAC_ADDRESSES[i][1]) &&
3722 (mac[2] == MAC_ADDRESSES[i][2]))
3725 #ifdef DEBUG_CONFIG_INFO
3727 "WaveLAN (0x%3X): your MAC address might be %02X:%02X:%02X.\n",
3728 ioaddr, mac[0], mac[1], mac[2]);
3733 /************************ INTERRUPT HANDLING ************************/
3736 * This function is the interrupt handler for the WaveLAN card. This
3737 * routine will be called whenever:
3739 static irqreturn_t wavelan_interrupt(int irq, void *dev_id)
3741 struct net_device *dev;
3742 unsigned long ioaddr;
3750 #ifdef DEBUG_INTERRUPT_TRACE
3751 printk(KERN_DEBUG "%s: ->wavelan_interrupt()\n", dev->name);
3754 lp = (net_local *) dev->priv;
3755 ioaddr = dev->base_addr;
3757 #ifdef DEBUG_INTERRUPT_INFO
3758 /* Check state of our spinlock */
3759 if(spin_is_locked(&lp->spinlock))
3761 "%s: wavelan_interrupt(): spinlock is already locked !!!\n",
3765 /* Prevent reentrancy. We need to do that because we may have
3766 * multiple interrupt handler running concurrently.
3767 * It is safe because interrupts are disabled before acquiring
3769 spin_lock(&lp->spinlock);
3771 /* We always had spurious interrupts at startup, but lately I
3772 * saw them comming *between* the request_irq() and the
3773 * spin_lock_irqsave() in wavelan_open(), so the spinlock
3774 * protection is no enough.
3775 * So, we also check lp->hacr that will tell us is we enabled
3776 * irqs or not (see wv_ints_on()).
3777 * We can't use netif_running(dev) because we depend on the
3778 * proper processing of the irq generated during the config. */
3780 /* Which interrupt it is ? */
3781 hasr = hasr_read(ioaddr);
3783 #ifdef DEBUG_INTERRUPT_INFO
3785 "%s: wavelan_interrupt(): hasr 0x%04x; hacr 0x%04x.\n",
3786 dev->name, hasr, lp->hacr);
3789 /* Check modem interrupt */
3790 if ((hasr & HASR_MMC_INTR) && (lp->hacr & HACR_MMC_INT_ENABLE)) {
3794 * Interrupt from the modem management controller.
3795 * This will clear it -- ignored for now.
3797 mmc_read(ioaddr, mmroff(0, mmr_dce_status), &dce_status,
3798 sizeof(dce_status));
3800 #ifdef DEBUG_INTERRUPT_ERROR
3802 "%s: wavelan_interrupt(): unexpected mmc interrupt: status 0x%04x.\n",
3803 dev->name, dce_status);
3807 /* Check if not controller interrupt */
3808 if (((hasr & HASR_82586_INTR) == 0) ||
3809 ((lp->hacr & HACR_82586_INT_ENABLE) == 0)) {
3810 #ifdef DEBUG_INTERRUPT_ERROR
3812 "%s: wavelan_interrupt(): interrupt not coming from i82586 - hasr 0x%04x.\n",
3815 spin_unlock (&lp->spinlock);
3819 /* Read interrupt data. */
3820 obram_read(ioaddr, scboff(OFFSET_SCB, scb_status),
3821 (unsigned char *) &status, sizeof(status));
3824 * Acknowledge the interrupt(s).
3826 ack_cmd = status & SCB_ST_INT;
3827 obram_write(ioaddr, scboff(OFFSET_SCB, scb_command),
3828 (unsigned char *) &ack_cmd, sizeof(ack_cmd));
3829 set_chan_attn(ioaddr, lp->hacr);
3831 #ifdef DEBUG_INTERRUPT_INFO
3832 printk(KERN_DEBUG "%s: wavelan_interrupt(): status 0x%04x.\n",
3836 /* Command completed. */
3837 if ((status & SCB_ST_CX) == SCB_ST_CX) {
3838 #ifdef DEBUG_INTERRUPT_INFO
3840 "%s: wavelan_interrupt(): command completed.\n",
3843 wv_complete(dev, ioaddr, lp);
3846 /* Frame received. */
3847 if ((status & SCB_ST_FR) == SCB_ST_FR) {
3848 #ifdef DEBUG_INTERRUPT_INFO
3850 "%s: wavelan_interrupt(): received packet.\n",
3856 /* Check the state of the command unit. */
3857 if (((status & SCB_ST_CNA) == SCB_ST_CNA) ||
3858 (((status & SCB_ST_CUS) != SCB_ST_CUS_ACTV) &&
3859 (netif_running(dev)))) {
3860 #ifdef DEBUG_INTERRUPT_ERROR
3862 "%s: wavelan_interrupt(): CU inactive -- restarting\n",
3868 /* Check the state of the command unit. */
3869 if (((status & SCB_ST_RNR) == SCB_ST_RNR) ||
3870 (((status & SCB_ST_RUS) != SCB_ST_RUS_RDY) &&
3871 (netif_running(dev)))) {
3872 #ifdef DEBUG_INTERRUPT_ERROR
3874 "%s: wavelan_interrupt(): RU not ready -- restarting\n",
3880 /* Release spinlock */
3881 spin_unlock (&lp->spinlock);
3883 #ifdef DEBUG_INTERRUPT_TRACE
3884 printk(KERN_DEBUG "%s: <-wavelan_interrupt()\n", dev->name);
3889 /*------------------------------------------------------------------*/
3891 * Watchdog: when we start a transmission, a timer is set for us in the
3892 * kernel. If the transmission completes, this timer is disabled. If
3893 * the timer expires, we are called and we try to unlock the hardware.
3895 static void wavelan_watchdog(struct net_device * dev)
3897 net_local * lp = (net_local *)dev->priv;
3898 u_long ioaddr = dev->base_addr;
3899 unsigned long flags;
3900 unsigned int nreaped;
3902 #ifdef DEBUG_INTERRUPT_TRACE
3903 printk(KERN_DEBUG "%s: ->wavelan_watchdog()\n", dev->name);
3906 #ifdef DEBUG_INTERRUPT_ERROR
3907 printk(KERN_INFO "%s: wavelan_watchdog: watchdog timer expired\n",
3911 /* Check that we came here for something */
3912 if (lp->tx_n_in_use <= 0) {
3916 spin_lock_irqsave(&lp->spinlock, flags);
3918 /* Try to see if some buffers are not free (in case we missed
3920 nreaped = wv_complete(dev, ioaddr, lp);
3922 #ifdef DEBUG_INTERRUPT_INFO
3924 "%s: wavelan_watchdog(): %d reaped, %d remain.\n",
3925 dev->name, nreaped, lp->tx_n_in_use);
3928 #ifdef DEBUG_PSA_SHOW
3931 psa_read(dev, 0, (unsigned char *) &psa, sizeof(psa));
3935 #ifdef DEBUG_MMC_SHOW
3938 #ifdef DEBUG_I82586_SHOW
3942 /* If no buffer has been freed */
3944 #ifdef DEBUG_INTERRUPT_ERROR
3946 "%s: wavelan_watchdog(): cleanup failed, trying reset\n",
3952 /* At this point, we should have some free Tx buffer ;-) */
3953 if (lp->tx_n_in_use < NTXBLOCKS - 1)
3954 netif_wake_queue(dev);
3956 spin_unlock_irqrestore(&lp->spinlock, flags);
3958 #ifdef DEBUG_INTERRUPT_TRACE
3959 printk(KERN_DEBUG "%s: <-wavelan_watchdog()\n", dev->name);
3963 /********************* CONFIGURATION CALLBACKS *********************/
3965 * Here are the functions called by the Linux networking code (NET3)
3966 * for initialization, configuration and deinstallations of the
3967 * WaveLAN ISA hardware.
3970 /*------------------------------------------------------------------*/
3972 * Configure and start up the WaveLAN PCMCIA adaptor.
3973 * Called by NET3 when it "opens" the device.
3975 static int wavelan_open(struct net_device * dev)
3977 net_local * lp = (net_local *)dev->priv;
3978 unsigned long flags;
3980 #ifdef DEBUG_CALLBACK_TRACE
3981 printk(KERN_DEBUG "%s: ->wavelan_open(dev=0x%x)\n", dev->name,
3982 (unsigned int) dev);
3986 if (dev->irq == 0) {
3987 #ifdef DEBUG_CONFIG_ERROR
3988 printk(KERN_WARNING "%s: wavelan_open(): no IRQ\n",
3994 if (request_irq(dev->irq, &wavelan_interrupt, 0, "WaveLAN", dev) != 0)
3996 #ifdef DEBUG_CONFIG_ERROR
3997 printk(KERN_WARNING "%s: wavelan_open(): invalid IRQ\n",
4003 spin_lock_irqsave(&lp->spinlock, flags);
4005 if (wv_hw_reset(dev) != -1) {
4006 netif_start_queue(dev);
4008 free_irq(dev->irq, dev);
4009 #ifdef DEBUG_CONFIG_ERROR
4011 "%s: wavelan_open(): impossible to start the card\n",
4014 spin_unlock_irqrestore(&lp->spinlock, flags);
4017 spin_unlock_irqrestore(&lp->spinlock, flags);
4019 #ifdef DEBUG_CALLBACK_TRACE
4020 printk(KERN_DEBUG "%s: <-wavelan_open()\n", dev->name);
4025 /*------------------------------------------------------------------*/
4027 * Shut down the WaveLAN ISA card.
4028 * Called by NET3 when it "closes" the device.
4030 static int wavelan_close(struct net_device * dev)
4032 net_local *lp = (net_local *) dev->priv;
4033 unsigned long flags;
4035 #ifdef DEBUG_CALLBACK_TRACE
4036 printk(KERN_DEBUG "%s: ->wavelan_close(dev=0x%x)\n", dev->name,
4037 (unsigned int) dev);
4040 netif_stop_queue(dev);
4043 * Flush the Tx and disable Rx.
4045 spin_lock_irqsave(&lp->spinlock, flags);
4047 spin_unlock_irqrestore(&lp->spinlock, flags);
4049 free_irq(dev->irq, dev);
4051 #ifdef DEBUG_CALLBACK_TRACE
4052 printk(KERN_DEBUG "%s: <-wavelan_close()\n", dev->name);
4057 /*------------------------------------------------------------------*/
4059 * Probe an I/O address, and if the WaveLAN is there configure the
4061 * (called by wavelan_probe() and via init_module()).
4063 static int __init wavelan_config(struct net_device *dev, unsigned short ioaddr)
4071 if (!request_region(ioaddr, sizeof(ha_t), "wavelan"))
4074 err = wv_check_ioaddr(ioaddr, mac);
4078 memcpy(dev->dev_addr, mac, 6);
4080 dev->base_addr = ioaddr;
4082 #ifdef DEBUG_CALLBACK_TRACE
4083 printk(KERN_DEBUG "%s: ->wavelan_config(dev=0x%x, ioaddr=0x%lx)\n",
4084 dev->name, (unsigned int) dev, ioaddr);
4087 /* Check IRQ argument on command line. */
4088 if (dev->irq != 0) {
4089 irq_mask = wv_irq_to_psa(dev->irq);
4091 if (irq_mask == 0) {
4092 #ifdef DEBUG_CONFIG_ERROR
4094 "%s: wavelan_config(): invalid IRQ %d ignored.\n",
4095 dev->name, dev->irq);
4099 #ifdef DEBUG_CONFIG_INFO
4101 "%s: wavelan_config(): changing IRQ to %d\n",
4102 dev->name, dev->irq);
4104 psa_write(ioaddr, HACR_DEFAULT,
4105 psaoff(0, psa_int_req_no), &irq_mask, 1);
4106 /* update the Wavelan checksum */
4107 update_psa_checksum(dev, ioaddr, HACR_DEFAULT);
4108 wv_hacr_reset(ioaddr);
4112 psa_read(ioaddr, HACR_DEFAULT, psaoff(0, psa_int_req_no),
4114 if ((irq = wv_psa_to_irq(irq_mask)) == -1) {
4115 #ifdef DEBUG_CONFIG_ERROR
4117 "%s: wavelan_config(): could not wavelan_map_irq(%d).\n",
4118 dev->name, irq_mask);
4126 dev->mem_start = 0x0000;
4127 dev->mem_end = 0x0000;
4130 /* Initialize device structures */
4131 memset(dev->priv, 0, sizeof(net_local));
4132 lp = (net_local *) dev->priv;
4134 /* Back link to the device structure. */
4136 /* Add the device at the beginning of the linked list. */
4137 lp->next = wavelan_list;
4140 lp->hacr = HACR_DEFAULT;
4142 /* Multicast stuff */
4143 lp->promiscuous = 0;
4147 spin_lock_init(&lp->spinlock);
4149 dev->open = wavelan_open;
4150 dev->stop = wavelan_close;
4151 dev->hard_start_xmit = wavelan_packet_xmit;
4152 dev->get_stats = wavelan_get_stats;
4153 dev->set_multicast_list = &wavelan_set_multicast_list;
4154 dev->tx_timeout = &wavelan_watchdog;
4155 dev->watchdog_timeo = WATCHDOG_JIFFIES;
4156 #ifdef SET_MAC_ADDRESS
4157 dev->set_mac_address = &wavelan_set_mac_address;
4158 #endif /* SET_MAC_ADDRESS */
4160 dev->wireless_handlers = &wavelan_handler_def;
4161 lp->wireless_data.spy_data = &lp->spy_data;
4162 dev->wireless_data = &lp->wireless_data;
4164 dev->mtu = WAVELAN_MTU;
4166 /* Display nice information. */
4169 #ifdef DEBUG_CALLBACK_TRACE
4170 printk(KERN_DEBUG "%s: <-wavelan_config()\n", dev->name);
4174 release_region(ioaddr, sizeof(ha_t));
4178 /*------------------------------------------------------------------*/
4180 * Check for a network adaptor of this type. Return '0' iff one
4181 * exists. There seem to be different interpretations of
4182 * the initial value of dev->base_addr.
4183 * We follow the example in drivers/net/ne.c.
4184 * (called in "Space.c")
4186 struct net_device * __init wavelan_probe(int unit)
4188 struct net_device *dev;
4194 /* compile-time check the sizes of structures */
4195 BUILD_BUG_ON(sizeof(psa_t) != PSA_SIZE);
4196 BUILD_BUG_ON(sizeof(mmw_t) != MMW_SIZE);
4197 BUILD_BUG_ON(sizeof(mmr_t) != MMR_SIZE);
4198 BUILD_BUG_ON(sizeof(ha_t) != HA_SIZE);
4200 dev = alloc_etherdev(sizeof(net_local));
4202 return ERR_PTR(-ENOMEM);
4204 sprintf(dev->name, "eth%d", unit);
4205 netdev_boot_setup_check(dev);
4206 base_addr = dev->base_addr;
4209 #ifdef DEBUG_CALLBACK_TRACE
4211 "%s: ->wavelan_probe(dev=%p (base_addr=0x%x))\n",
4212 dev->name, dev, (unsigned int) dev->base_addr);
4215 /* Don't probe at all. */
4216 if (base_addr < 0) {
4217 #ifdef DEBUG_CONFIG_ERROR
4219 "%s: wavelan_probe(): invalid base address\n",
4223 } else if (base_addr > 0x100) { /* Check a single specified location. */
4224 r = wavelan_config(dev, base_addr);
4225 #ifdef DEBUG_CONFIG_INFO
4228 "%s: wavelan_probe(): no device at specified base address (0x%X) or address already in use\n",
4229 dev->name, base_addr);
4232 #ifdef DEBUG_CALLBACK_TRACE
4233 printk(KERN_DEBUG "%s: <-wavelan_probe()\n", dev->name);
4235 } else { /* Scan all possible addresses of the WaveLAN hardware. */
4236 for (i = 0; i < ARRAY_SIZE(iobase); i++) {
4238 if (wavelan_config(dev, iobase[i]) == 0) {
4239 #ifdef DEBUG_CALLBACK_TRACE
4241 "%s: <-wavelan_probe()\n",
4247 if (i == ARRAY_SIZE(iobase))
4252 r = register_netdev(dev);
4257 release_region(dev->base_addr, sizeof(ha_t));
4258 wavelan_list = wavelan_list->next;
4264 /****************************** MODULE ******************************/
4266 * Module entry point: insertion and removal
4270 /*------------------------------------------------------------------*/
4272 * Insertion of the module
4273 * I'm now quite proud of the multi-device support.
4275 int __init init_module(void)
4277 int ret = -EIO; /* Return error if no cards found */
4280 #ifdef DEBUG_MODULE_TRACE
4281 printk(KERN_DEBUG "-> init_module()\n");
4284 /* If probing is asked */
4286 #ifdef DEBUG_CONFIG_ERROR
4288 "WaveLAN init_module(): doing device probing (bad !)\n");
4290 "Specify base addresses while loading module to correct the problem\n");
4293 /* Copy the basic set of address to be probed. */
4294 for (i = 0; i < ARRAY_SIZE(iobase); i++)
4299 /* Loop on all possible base addresses. */
4301 while ((io[++i] != 0) && (i < ARRAY_SIZE(io))) {
4302 struct net_device *dev = alloc_etherdev(sizeof(net_local));
4306 strcpy(dev->name, name[i]); /* Copy name */
4307 dev->base_addr = io[i];
4310 /* Check if there is something at this base address. */
4311 if (wavelan_config(dev, io[i]) == 0) {
4312 if (register_netdev(dev) != 0) {
4313 release_region(dev->base_addr, sizeof(ha_t));
4314 wavelan_list = wavelan_list->next;
4323 #ifdef DEBUG_CONFIG_ERROR
4326 "WaveLAN init_module(): no device found\n");
4329 #ifdef DEBUG_MODULE_TRACE
4330 printk(KERN_DEBUG "<- init_module()\n");
4335 /*------------------------------------------------------------------*/
4337 * Removal of the module
4339 void cleanup_module(void)
4341 #ifdef DEBUG_MODULE_TRACE
4342 printk(KERN_DEBUG "-> cleanup_module()\n");
4345 /* Loop on all devices and release them. */
4346 while (wavelan_list) {
4347 struct net_device *dev = wavelan_list->dev;
4349 #ifdef DEBUG_CONFIG_INFO
4351 "%s: cleanup_module(): removing device at 0x%x\n",
4352 dev->name, (unsigned int) dev);
4354 unregister_netdev(dev);
4356 release_region(dev->base_addr, sizeof(ha_t));
4357 wavelan_list = wavelan_list->next;
4362 #ifdef DEBUG_MODULE_TRACE
4363 printk(KERN_DEBUG "<- cleanup_module()\n");
4367 MODULE_LICENSE("GPL");
4370 * This software may only be used and distributed
4371 * according to the terms of the GNU General Public License.
4373 * This software was developed as a component of the
4374 * Linux operating system.
4375 * It is based on other device drivers and information
4376 * either written or supplied by:
4377 * Ajay Bakre (bakre@paul.rutgers.edu),
4378 * Donald Becker (becker@scyld.com),
4379 * Loeke Brederveld (Loeke.Brederveld@Utrecht.NCR.com),
4380 * Anders Klemets (klemets@it.kth.se),
4381 * Vladimir V. Kolpakov (w@stier.koenig.ru),
4382 * Marc Meertens (Marc.Meertens@Utrecht.NCR.com),
4383 * Pauline Middelink (middelin@polyware.iaf.nl),
4384 * Robert Morris (rtm@das.harvard.edu),
4385 * Jean Tourrilhes (jt@hplb.hpl.hp.com),
4386 * Girish Welling (welling@paul.rutgers.edu),
4388 * Thanks go also to:
4389 * James Ashton (jaa101@syseng.anu.edu.au),
4390 * Alan Cox (alan@lxorguk.ukuu.org.uk),
4391 * Allan Creighton (allanc@cs.usyd.edu.au),
4392 * Matthew Geier (matthew@cs.usyd.edu.au),
4393 * Remo di Giovanni (remo@cs.usyd.edu.au),
4394 * Eckhard Grah (grah@wrcs1.urz.uni-wuppertal.de),
4395 * Vipul Gupta (vgupta@cs.binghamton.edu),
4396 * Mark Hagan (mhagan@wtcpost.daytonoh.NCR.COM),
4397 * Tim Nicholson (tim@cs.usyd.edu.au),
4398 * Ian Parkin (ian@cs.usyd.edu.au),
4399 * John Rosenberg (johnr@cs.usyd.edu.au),
4400 * George Rossi (george@phm.gov.au),
4401 * Arthur Scott (arthur@cs.usyd.edu.au),
4403 * for their assistance and advice.
4405 * Please send bug reports, updates, comments to:
4407 * Bruce Janson Email: bruce@cs.usyd.edu.au
4408 * Basser Department of Computer Science Phone: +61-2-9351-3423
4409 * University of Sydney, N.S.W., 2006, AUSTRALIA Fax: +61-2-9351-3838