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 * Wrapper for disabling interrupts.
29 static inline unsigned long
40 /*------------------------------------------------------------------*/
42 * Wrapper for re-enabling interrupts.
45 wv_splx(unsigned long flags
)
50 /*------------------------------------------------------------------*/
52 * Translate irq number to PSA irq parameter
55 wv_irq_to_psa(int irq
)
57 if(irq
< 0 || irq
>= NELS(irqvals
))
63 /*------------------------------------------------------------------*/
65 * Translate PSA irq parameter to irq number
68 wv_psa_to_irq(u_char irqval
)
72 for(irq
= 0; irq
< NELS(irqvals
); irq
++)
73 if(irqvals
[irq
] == irqval
)
80 /*------------------------------------------------------------------*/
82 * Sanity routine to verify the sizes of the various WaveLAN interface
88 #define SC(t,s,n) if (sizeof(t) != s) return(n);
90 SC(psa_t
, PSA_SIZE
, "psa_t");
91 SC(mmw_t
, MMW_SIZE
, "mmw_t");
92 SC(mmr_t
, MMR_SIZE
, "mmr_t");
93 SC(ha_t
, HA_SIZE
, "ha_t");
97 return((char *) NULL
);
98 } /* wv_struct_check */
99 #endif /* STRUCT_CHECK */
101 /********************* HOST ADAPTER SUBROUTINES *********************/
103 * Useful subroutines to manage the WaveLAN ISA interface
105 * One major difference with the PCMCIA hardware (except the port mapping)
106 * is that we have to keep the state of the Host Control Register
107 * because of the interrupt enable & bus size flags.
110 /*------------------------------------------------------------------*/
112 * Read from card's Host Adaptor Status Register.
114 static inline u_short
115 hasr_read(u_long ioaddr
)
117 return(inw(HASR(ioaddr
)));
120 /*------------------------------------------------------------------*/
122 * Write to card's Host Adapter Command Register.
125 hacr_write(u_long ioaddr
,
128 outw(hacr
, HACR(ioaddr
));
131 /*------------------------------------------------------------------*/
133 * Write to card's Host Adapter Command Register. Include a delay for
134 * those times when it is needed.
137 hacr_write_slow(u_long ioaddr
,
140 hacr_write(ioaddr
, hacr
);
141 /* delay might only be needed sometimes */
143 } /* hacr_write_slow */
145 /*------------------------------------------------------------------*/
147 * Set the channel attention bit.
150 set_chan_attn(u_long ioaddr
,
153 hacr_write(ioaddr
, hacr
| HACR_CA
);
154 } /* set_chan_attn */
156 /*------------------------------------------------------------------*/
158 * Reset, and then set host adaptor into default mode.
161 wv_hacr_reset(u_long ioaddr
)
163 hacr_write_slow(ioaddr
, HACR_RESET
);
164 hacr_write(ioaddr
, HACR_DEFAULT
);
165 } /* wv_hacr_reset */
167 /*------------------------------------------------------------------*/
169 * Set the I/O transfer over the ISA bus to 8-bit mode
172 wv_16_off(u_long ioaddr
,
175 hacr
&= ~HACR_16BITS
;
176 hacr_write(ioaddr
, hacr
);
179 /*------------------------------------------------------------------*/
181 * Set the I/O transfer over the ISA bus to 8-bit mode
184 wv_16_on(u_long ioaddr
,
188 hacr_write(ioaddr
, hacr
);
191 /*------------------------------------------------------------------*/
193 * Disable interrupts on the WaveLAN hardware.
196 wv_ints_off(device
* dev
)
198 net_local
* lp
= (net_local
*)dev
->priv
;
199 u_long ioaddr
= dev
->base_addr
;
204 lp
->hacr
&= ~HACR_INTRON
;
205 hacr_write(ioaddr
, lp
->hacr
);
210 /*------------------------------------------------------------------*/
212 * Enable interrupts on the WaveLAN hardware.
215 wv_ints_on(device
* dev
)
217 net_local
* lp
= (net_local
*)dev
->priv
;
218 u_long ioaddr
= dev
->base_addr
;
223 lp
->hacr
|= HACR_INTRON
;
224 hacr_write(ioaddr
, lp
->hacr
);
229 /******************* MODEM MANAGEMENT SUBROUTINES *******************/
231 * Useful subroutines to manage the modem of the WaveLAN
234 /*------------------------------------------------------------------*/
236 * Read the Parameter Storage Area from the WaveLAN card's memory
239 * Read bytes from the PSA.
242 psa_read(u_long ioaddr
,
244 int o
, /* offset in PSA */
245 u_char
* b
, /* buffer to fill */
246 int n
) /* size to read */
248 wv_16_off(ioaddr
, hacr
);
252 outw(o
, PIOR2(ioaddr
));
254 *b
++ = inb(PIOP2(ioaddr
));
257 wv_16_on(ioaddr
, hacr
);
260 /*------------------------------------------------------------------*/
262 * Write the Parameter Storage Area to the WaveLAN card's memory.
265 psa_write(u_long ioaddr
,
267 int o
, /* Offset in PSA */
268 u_char
* b
, /* Buffer in memory */
269 int n
) /* Length of buffer */
273 wv_16_off(ioaddr
, hacr
);
277 outw(o
, PIOR2(ioaddr
));
280 outb(*b
, PIOP2(ioaddr
));
283 /* Wait for the memory to finish its write cycle */
285 while((count
++ < 100) &&
286 (hasr_read(ioaddr
) & HASR_PSA_BUSY
))
290 wv_16_on(ioaddr
, hacr
);
294 /*------------------------------------------------------------------*/
296 * Calculate the PSA CRC
297 * Thanks to Valster, Nico <NVALSTER@wcnd.nl.lucent.com> for the code
298 * NOTE: By specifying a length including the CRC position the
299 * returned value should be zero. (i.e. a correct checksum in the PSA)
301 * The Windows drivers don't use the CRC, but the AP and the PtP tool
304 static inline u_short
305 psa_crc(u_char
* psa
, /* The PSA */
306 int size
) /* Number of short for CRC */
308 int byte_cnt
; /* Loop on the PSA */
309 u_short crc_bytes
= 0; /* Data in the PSA */
310 int bit_cnt
; /* Loop on the bits of the short */
312 for(byte_cnt
= 0; byte_cnt
< size
; byte_cnt
++ )
314 crc_bytes
^= psa
[byte_cnt
]; /* Its an xor */
316 for(bit_cnt
= 1; bit_cnt
< 9; bit_cnt
++ )
318 if(crc_bytes
& 0x0001)
319 crc_bytes
= (crc_bytes
>> 1) ^ 0xA001;
327 #endif /* SET_PSA_CRC */
329 /*------------------------------------------------------------------*/
331 * update the checksum field in the Wavelan's PSA
334 update_psa_checksum(device
* dev
,
342 /* read the parameter storage area */
343 psa_read(ioaddr
, hacr
, 0, (unsigned char *) &psa
, sizeof(psa
));
345 /* update the checksum */
346 crc
= psa_crc((unsigned char *) &psa
,
347 sizeof(psa
) - sizeof(psa
.psa_crc
[0]) - sizeof(psa
.psa_crc
[1])
348 - sizeof(psa
.psa_crc_status
));
350 psa
.psa_crc
[0] = crc
& 0xFF;
351 psa
.psa_crc
[1] = (crc
& 0xFF00) >> 8;
354 psa_write(ioaddr
, hacr
, (char *)&psa
.psa_crc
- (char *)&psa
,
355 (unsigned char *)&psa
.psa_crc
, 2);
357 #ifdef DEBUG_IOCTL_INFO
358 printk (KERN_DEBUG
"%s: update_psa_checksum(): crc = 0x%02x%02x\n",
359 dev
->name
, psa
.psa_crc
[0], psa
.psa_crc
[1]);
361 /* Check again (luxury !) */
362 crc
= psa_crc ((unsigned char *) &psa
,
363 sizeof(psa
) - sizeof(psa
.psa_crc_status
));
366 printk(KERN_WARNING
"%s: update_psa_checksum(): CRC does not agree with PSA data (even after recalculating)\n", dev
->name
);
367 #endif /* DEBUG_IOCTL_INFO */
368 #endif /* SET_PSA_CRC */
369 } /* update_psa_checksum */
371 /*------------------------------------------------------------------*/
373 * Write 1 byte to the MMC.
376 mmc_out(u_long ioaddr
,
380 /* Wait for MMC to go idle */
381 while(inw(HASR(ioaddr
)) & HASR_MMC_BUSY
)
384 outw((u_short
) (((u_short
) d
<< 8) | (o
<< 1) | 1),
388 /*------------------------------------------------------------------*/
390 * Routine to write bytes to the Modem Management Controller.
391 * We start at the end because it is the way it should be!
394 mmc_write(u_long ioaddr
,
403 mmc_out(ioaddr
, --o
, *(--b
));
406 /*------------------------------------------------------------------*/
408 * Read a byte from the MMC.
409 * Optimised version for 1 byte, avoid using memory.
412 mmc_in(u_long ioaddr
,
415 while(inw(HASR(ioaddr
)) & HASR_MMC_BUSY
)
417 outw(o
<< 1, MMCR(ioaddr
));
419 while(inw(HASR(ioaddr
)) & HASR_MMC_BUSY
)
421 return (u_char
) (inw(MMCR(ioaddr
)) >> 8);
424 /*------------------------------------------------------------------*/
426 * Routine to read bytes from the Modem Management Controller.
427 * The implementation is complicated by a lack of address lines,
428 * which prevents decoding of the low-order bit.
429 * (code has just been moved in the above function)
430 * We start at the end because it is the way it should be!
433 mmc_read(u_long ioaddr
,
442 *(--b
) = mmc_in(ioaddr
, --o
);
445 /*------------------------------------------------------------------*/
447 * Get the type of encryption available.
450 mmc_encr(u_long ioaddr
) /* I/O port of the card */
454 temp
= mmc_in(ioaddr
, mmroff(0, mmr_des_avail
));
455 if((temp
!= MMR_DES_AVAIL_DES
) && (temp
!= MMR_DES_AVAIL_AES
))
461 /*------------------------------------------------------------------*/
463 * Wait for the frequency EEPROM to complete a command.
464 * I hope this one will be optimally inlined.
467 fee_wait(u_long ioaddr
, /* I/O port of the card */
468 int delay
, /* Base delay to wait for */
469 int number
) /* Number of time to wait */
471 int count
= 0; /* Wait only a limited time */
473 while((count
++ < number
) &&
474 (mmc_in(ioaddr
, mmroff(0, mmr_fee_status
)) & MMR_FEE_STATUS_BUSY
))
478 /*------------------------------------------------------------------*/
480 * Read bytes from the Frequency EEPROM (frequency select cards).
483 fee_read(u_long ioaddr
, /* I/O port of the card */
484 u_short o
, /* destination offset */
485 u_short
* b
, /* data buffer */
486 int n
) /* number of registers */
488 b
+= n
; /* Position at the end of the area */
490 /* Write the address */
491 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), o
+ n
- 1);
493 /* Loop on all buffer */
496 /* Write the read command */
497 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_READ
);
499 /* Wait until EEPROM is ready (should be quick). */
500 fee_wait(ioaddr
, 10, 100);
502 /* Read the value. */
503 *--b
= ((mmc_in(ioaddr
, mmroff(0, mmr_fee_data_h
)) << 8) |
504 mmc_in(ioaddr
, mmroff(0, mmr_fee_data_l
)));
508 #ifdef WIRELESS_EXT /* if the wireless extension exists in the kernel */
510 /*------------------------------------------------------------------*/
512 * Write bytes from the Frequency EEPROM (frequency select cards).
513 * This is a bit complicated, because the frequency EEPROM has to
514 * be unprotected and the write enabled.
518 fee_write(u_long ioaddr
, /* I/O port of the card */
519 u_short o
, /* destination offset */
520 u_short
* b
, /* data buffer */
521 int n
) /* number of registers */
523 b
+= n
; /* Position at the end of the area. */
525 #ifdef EEPROM_IS_PROTECTED /* disabled */
526 #ifdef DOESNT_SEEM_TO_WORK /* disabled */
527 /* Ask to read the protected register */
528 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_PRREAD
);
530 fee_wait(ioaddr
, 10, 100);
532 /* Read the protected register. */
533 printk("Protected 2: %02X-%02X\n",
534 mmc_in(ioaddr
, mmroff(0, mmr_fee_data_h
)),
535 mmc_in(ioaddr
, mmroff(0, mmr_fee_data_l
)));
536 #endif /* DOESNT_SEEM_TO_WORK */
538 /* Enable protected register. */
539 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), MMW_FEE_ADDR_EN
);
540 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_PREN
);
542 fee_wait(ioaddr
, 10, 100);
544 /* Unprotect area. */
545 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), o
+ n
);
546 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_PRWRITE
);
547 #ifdef DOESNT_SEEM_TO_WORK /* disabled */
549 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_PRCLEAR
);
550 #endif /* DOESNT_SEEM_TO_WORK */
552 fee_wait(ioaddr
, 10, 100);
553 #endif /* EEPROM_IS_PROTECTED */
556 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), MMW_FEE_ADDR_EN
);
557 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_WREN
);
559 fee_wait(ioaddr
, 10, 100);
561 /* Write the EEPROM address. */
562 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), o
+ n
- 1);
564 /* Loop on all buffer */
567 /* Write the value. */
568 mmc_out(ioaddr
, mmwoff(0, mmw_fee_data_h
), (*--b
) >> 8);
569 mmc_out(ioaddr
, mmwoff(0, mmw_fee_data_l
), *b
& 0xFF);
571 /* Write the write command. */
572 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_WRITE
);
574 /* WaveLAN documentation says to wait at least 10 ms for EEBUSY = 0 */
576 fee_wait(ioaddr
, 10, 100);
580 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), MMW_FEE_ADDR_DS
);
581 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_WDS
);
583 fee_wait(ioaddr
, 10, 100);
585 #ifdef EEPROM_IS_PROTECTED /* disabled */
586 /* Reprotect EEPROM. */
587 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), 0x00);
588 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
), MMW_FEE_CTRL_PRWRITE
);
590 fee_wait(ioaddr
, 10, 100);
591 #endif /* EEPROM_IS_PROTECTED */
593 #endif /* WIRELESS_EXT */
595 /************************ I82586 SUBROUTINES *************************/
597 * Useful subroutines to manage the Ethernet controller
600 /*------------------------------------------------------------------*/
602 * Read bytes from the on-board RAM.
603 * Why does inlining this function make it fail?
605 static /*inline*/ void
606 obram_read(u_long ioaddr
,
611 outw(o
, PIOR1(ioaddr
));
612 insw(PIOP1(ioaddr
), (unsigned short *) b
, (n
+ 1) >> 1);
615 /*------------------------------------------------------------------*/
617 * Write bytes to the on-board RAM.
620 obram_write(u_long ioaddr
,
625 outw(o
, PIOR1(ioaddr
));
626 outsw(PIOP1(ioaddr
), (unsigned short *) b
, (n
+ 1) >> 1);
629 /*------------------------------------------------------------------*/
631 * Acknowledge the reading of the status issued by the i82586.
636 net_local
* lp
= (net_local
*)dev
->priv
;
637 u_long ioaddr
= dev
->base_addr
;
641 obram_read(ioaddr
, scboff(OFFSET_SCB
, scb_status
),
642 (unsigned char *) &scb_cs
, sizeof(scb_cs
));
643 scb_cs
&= SCB_ST_INT
;
648 obram_write(ioaddr
, scboff(OFFSET_SCB
, scb_command
),
649 (unsigned char *) &scb_cs
, sizeof(scb_cs
));
651 set_chan_attn(ioaddr
, lp
->hacr
);
653 for(i
= 1000; i
> 0; i
--)
655 obram_read(ioaddr
, scboff(OFFSET_SCB
, scb_command
), (unsigned char *)&scb_cs
, sizeof(scb_cs
));
663 #ifdef DEBUG_CONFIG_ERROR
665 printk(KERN_INFO
"%s: wv_ack(): board not accepting command.\n",
670 /*------------------------------------------------------------------*/
672 * Set channel attention bit and busy wait until command has
673 * completed, then acknowledge completion of the command.
676 wv_synchronous_cmd(device
* dev
,
679 net_local
* lp
= (net_local
*)dev
->priv
;
680 u_long ioaddr
= dev
->base_addr
;
685 scb_cmd
= SCB_CMD_CUC
& SCB_CMD_CUC_GO
;
686 obram_write(ioaddr
, scboff(OFFSET_SCB
, scb_command
),
687 (unsigned char *) &scb_cmd
, sizeof(scb_cmd
));
689 set_chan_attn(ioaddr
, lp
->hacr
);
691 for (i
= 1000; i
> 0; i
--)
693 obram_read(ioaddr
, OFFSET_CU
, (unsigned char *)&cb
, sizeof(cb
));
694 if (cb
.ac_status
& AC_SFLD_C
)
701 if(i
<= 0 || !(cb
.ac_status
& AC_SFLD_OK
))
703 #ifdef DEBUG_CONFIG_ERROR
704 printk(KERN_INFO
"%s: %s failed; status = 0x%x\n",
705 dev
->name
, str
, cb
.ac_status
);
707 #ifdef DEBUG_I82586_SHOW
719 /*------------------------------------------------------------------*/
721 * Configuration commands completion interrupt.
722 * Check if done, and if OK.
725 wv_config_complete(device
* dev
,
729 unsigned short mcs_addr
;
730 unsigned short status
;
733 #ifdef DEBUG_INTERRUPT_TRACE
734 printk(KERN_DEBUG
"%s: ->wv_config_complete()\n", dev
->name
);
737 mcs_addr
= lp
->tx_first_in_use
+ sizeof(ac_tx_t
) + sizeof(ac_nop_t
)
738 + sizeof(tbd_t
) + sizeof(ac_cfg_t
) + sizeof(ac_ias_t
);
740 /* Read the status of the last command (set mc list). */
741 obram_read(ioaddr
, acoff(mcs_addr
, ac_status
), (unsigned char *)&status
, sizeof(status
));
743 /* If not completed -> exit */
744 if((status
& AC_SFLD_C
) == 0)
745 ret
= 0; /* Not ready to be scrapped */
748 #ifdef DEBUG_CONFIG_ERROR
749 unsigned short cfg_addr
;
750 unsigned short ias_addr
;
752 /* Check mc_config command */
753 if((status
& AC_SFLD_OK
) != AC_SFLD_OK
)
754 printk(KERN_INFO
"%s: wv_config_complete(): set_multicast_address failed; status = 0x%x\n",
757 /* check ia-config command */
758 ias_addr
= mcs_addr
- sizeof(ac_ias_t
);
759 obram_read(ioaddr
, acoff(ias_addr
, ac_status
), (unsigned char *)&status
, sizeof(status
));
760 if((status
& AC_SFLD_OK
) != AC_SFLD_OK
)
761 printk(KERN_INFO
"%s: wv_config_complete(): set_MAC_address failed; status = 0x%x\n",
764 /* Check config command. */
765 cfg_addr
= ias_addr
- sizeof(ac_cfg_t
);
766 obram_read(ioaddr
, acoff(cfg_addr
, ac_status
), (unsigned char *)&status
, sizeof(status
));
767 if((status
& AC_SFLD_OK
) != AC_SFLD_OK
)
768 printk(KERN_INFO
"%s: wv_config_complete(): configure failed; status = 0x%x\n",
770 #endif /* DEBUG_CONFIG_ERROR */
772 ret
= 1; /* Ready to be scrapped */
775 #ifdef DEBUG_INTERRUPT_TRACE
776 printk(KERN_DEBUG
"%s: <-wv_config_complete() - %d\n", dev
->name
, ret
);
781 /*------------------------------------------------------------------*/
783 * Command completion interrupt.
784 * Reclaim as many freed tx buffers as we can.
787 wv_complete(device
* dev
,
793 #ifdef DEBUG_INTERRUPT_TRACE
794 printk(KERN_DEBUG
"%s: ->wv_complete()\n", dev
->name
);
797 /* Loop on all the transmit buffers */
798 while(lp
->tx_first_in_use
!= I82586NULL
)
800 unsigned short tx_status
;
802 /* Read the first transmit buffer */
803 obram_read(ioaddr
, acoff(lp
->tx_first_in_use
, ac_status
), (unsigned char *)&tx_status
, sizeof(tx_status
));
805 /* If not completed -> exit */
806 if((tx_status
& AC_SFLD_C
) == 0)
809 /* Hack for reconfiguration */
810 if(tx_status
== 0xFFFF)
811 if(!wv_config_complete(dev
, ioaddr
, lp
))
812 break; /* Not completed */
814 /* We now remove this buffer */
819 if (lp->tx_n_in_use > 0)
820 printk("%c", "0123456789abcdefghijk"[lp->tx_n_in_use]);
823 /* Was it the last one? */
824 if(lp
->tx_n_in_use
<= 0)
825 lp
->tx_first_in_use
= I82586NULL
;
828 /* Next one in the chain */
829 lp
->tx_first_in_use
+= TXBLOCKZ
;
830 if(lp
->tx_first_in_use
>= OFFSET_CU
+ NTXBLOCKS
* TXBLOCKZ
)
831 lp
->tx_first_in_use
-= NTXBLOCKS
* TXBLOCKZ
;
834 /* Hack for reconfiguration */
835 if(tx_status
== 0xFFFF)
838 /* Now, check status of the finished command */
839 if(tx_status
& AC_SFLD_OK
)
843 lp
->stats
.tx_packets
++;
844 ncollisions
= tx_status
& AC_SFLD_MAXCOL
;
845 lp
->stats
.collisions
+= ncollisions
;
848 printk(KERN_DEBUG
"%s: wv_complete(): tx completed after %d collisions.\n",
849 dev
->name
, ncollisions
);
854 lp
->stats
.tx_errors
++;
855 if(tx_status
& AC_SFLD_S10
)
857 lp
->stats
.tx_carrier_errors
++;
859 printk(KERN_DEBUG
"%s: wv_complete(): tx error: no CS.\n",
863 if(tx_status
& AC_SFLD_S9
)
865 lp
->stats
.tx_carrier_errors
++;
867 printk(KERN_DEBUG
"%s: wv_complete(): tx error: lost CTS.\n",
871 if(tx_status
& AC_SFLD_S8
)
873 lp
->stats
.tx_fifo_errors
++;
875 printk(KERN_DEBUG
"%s: wv_complete(): tx error: slow DMA.\n",
879 if(tx_status
& AC_SFLD_S6
)
881 lp
->stats
.tx_heartbeat_errors
++;
883 printk(KERN_DEBUG
"%s: wv_complete(): tx error: heart beat.\n",
887 if(tx_status
& AC_SFLD_S5
)
889 lp
->stats
.tx_aborted_errors
++;
891 printk(KERN_DEBUG
"%s: wv_complete(): tx error: too many collisions.\n",
898 printk(KERN_DEBUG
"%s: wv_complete(): tx completed, tx_status 0x%04x\n",
899 dev
->name
, tx_status
);
903 #ifdef DEBUG_INTERRUPT_INFO
905 printk(KERN_DEBUG
"%s: wv_complete(): reaped %d\n", dev
->name
, nreaped
);
909 * Inform upper layers.
911 if(lp
->tx_n_in_use
< NTXBLOCKS
- 1)
917 #ifdef DEBUG_INTERRUPT_TRACE
918 printk(KERN_DEBUG
"%s: <-wv_complete()\n", dev
->name
);
923 /*------------------------------------------------------------------*/
925 * Reconfigure the i82586, or at least ask for it.
926 * Because wv_82586_config uses a transmission buffer, we must do it
927 * when we are sure that there is one left, so we do it now
928 * or in wavelan_packet_xmit() (I can't find any better place,
929 * wavelan_interrupt is not an option), so you may experience
933 wv_82586_reconfig(device
* dev
)
935 net_local
* lp
= (net_local
*)dev
->priv
;
937 /* Check if we can do it now ! */
938 if(!(dev
->start
) || (test_and_set_bit(0, (void *)&dev
->tbusy
) != 0))
940 lp
->reconfig_82586
= 1;
941 #ifdef DEBUG_CONFIG_INFO
942 printk(KERN_DEBUG
"%s: wv_82586_reconfig(): delayed (busy = %ld, start = %d)\n",
943 dev
->name
, dev
->tbusy
, dev
->start
);
947 wv_82586_config(dev
);
950 /********************* DEBUG & INFO SUBROUTINES *********************/
952 * This routine is used in the code to show information for debugging.
953 * Most of the time, it dumps the contents of hardware structures.
956 #ifdef DEBUG_PSA_SHOW
957 /*------------------------------------------------------------------*/
959 * Print the formatted contents of the Parameter Storage Area.
962 wv_psa_show(psa_t
* p
)
964 printk(KERN_DEBUG
"##### WaveLAN PSA contents: #####\n");
965 printk(KERN_DEBUG
"psa_io_base_addr_1: 0x%02X %02X %02X %02X\n",
966 p
->psa_io_base_addr_1
,
967 p
->psa_io_base_addr_2
,
968 p
->psa_io_base_addr_3
,
969 p
->psa_io_base_addr_4
);
970 printk(KERN_DEBUG
"psa_rem_boot_addr_1: 0x%02X %02X %02X\n",
971 p
->psa_rem_boot_addr_1
,
972 p
->psa_rem_boot_addr_2
,
973 p
->psa_rem_boot_addr_3
);
974 printk(KERN_DEBUG
"psa_holi_params: 0x%02x, ", p
->psa_holi_params
);
975 printk("psa_int_req_no: %d\n", p
->psa_int_req_no
);
976 #ifdef DEBUG_SHOW_UNUSED
977 printk(KERN_DEBUG
"psa_unused0[]: %02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
985 #endif /* DEBUG_SHOW_UNUSED */
986 printk(KERN_DEBUG
"psa_univ_mac_addr[]: %02x:%02x:%02x:%02x:%02x:%02x\n",
987 p
->psa_univ_mac_addr
[0],
988 p
->psa_univ_mac_addr
[1],
989 p
->psa_univ_mac_addr
[2],
990 p
->psa_univ_mac_addr
[3],
991 p
->psa_univ_mac_addr
[4],
992 p
->psa_univ_mac_addr
[5]);
993 printk(KERN_DEBUG
"psa_local_mac_addr[]: %02x:%02x:%02x:%02x:%02x:%02x\n",
994 p
->psa_local_mac_addr
[0],
995 p
->psa_local_mac_addr
[1],
996 p
->psa_local_mac_addr
[2],
997 p
->psa_local_mac_addr
[3],
998 p
->psa_local_mac_addr
[4],
999 p
->psa_local_mac_addr
[5]);
1000 printk(KERN_DEBUG
"psa_univ_local_sel: %d, ", p
->psa_univ_local_sel
);
1001 printk("psa_comp_number: %d, ", p
->psa_comp_number
);
1002 printk("psa_thr_pre_set: 0x%02x\n", p
->psa_thr_pre_set
);
1003 printk(KERN_DEBUG
"psa_feature_select/decay_prm: 0x%02x, ",
1004 p
->psa_feature_select
);
1005 printk("psa_subband/decay_update_prm: %d\n", p
->psa_subband
);
1006 printk(KERN_DEBUG
"psa_quality_thr: 0x%02x, ", p
->psa_quality_thr
);
1007 printk("psa_mod_delay: 0x%02x\n", p
->psa_mod_delay
);
1008 printk(KERN_DEBUG
"psa_nwid: 0x%02x%02x, ", p
->psa_nwid
[0], p
->psa_nwid
[1]);
1009 printk("psa_nwid_select: %d\n", p
->psa_nwid_select
);
1010 printk(KERN_DEBUG
"psa_encryption_select: %d, ", p
->psa_encryption_select
);
1011 printk("psa_encryption_key[]: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
1012 p
->psa_encryption_key
[0],
1013 p
->psa_encryption_key
[1],
1014 p
->psa_encryption_key
[2],
1015 p
->psa_encryption_key
[3],
1016 p
->psa_encryption_key
[4],
1017 p
->psa_encryption_key
[5],
1018 p
->psa_encryption_key
[6],
1019 p
->psa_encryption_key
[7]);
1020 printk(KERN_DEBUG
"psa_databus_width: %d\n", p
->psa_databus_width
);
1021 printk(KERN_DEBUG
"psa_call_code/auto_squelch: 0x%02x, ",
1022 p
->psa_call_code
[0]);
1023 printk("psa_call_code[]: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
1024 p
->psa_call_code
[0],
1025 p
->psa_call_code
[1],
1026 p
->psa_call_code
[2],
1027 p
->psa_call_code
[3],
1028 p
->psa_call_code
[4],
1029 p
->psa_call_code
[5],
1030 p
->psa_call_code
[6],
1031 p
->psa_call_code
[7]);
1032 #ifdef DEBUG_SHOW_UNUSED
1033 printk(KERN_DEBUG
"psa_reserved[]: %02X:%02X:%02X:%02X\n",
1037 p
->psa_reserved
[3]);
1038 #endif /* DEBUG_SHOW_UNUSED */
1039 printk(KERN_DEBUG
"psa_conf_status: %d, ", p
->psa_conf_status
);
1040 printk("psa_crc: 0x%02x%02x, ", p
->psa_crc
[0], p
->psa_crc
[1]);
1041 printk("psa_crc_status: 0x%02x\n", p
->psa_crc_status
);
1043 #endif /* DEBUG_PSA_SHOW */
1045 #ifdef DEBUG_MMC_SHOW
1046 /*------------------------------------------------------------------*/
1048 * Print the formatted status of the Modem Management Controller.
1049 * This function needs to be completed.
1052 wv_mmc_show(device
* dev
)
1054 u_long ioaddr
= dev
->base_addr
;
1055 net_local
* lp
= (net_local
*)dev
->priv
;
1059 if(hasr_read(ioaddr
) & HASR_NO_CLK
)
1061 printk(KERN_WARNING
"%s: wv_mmc_show: modem not connected\n",
1067 mmc_out(ioaddr
, mmwoff(0, mmw_freeze
), 1);
1068 mmc_read(ioaddr
, 0, (u_char
*)&m
, sizeof(m
));
1069 mmc_out(ioaddr
, mmwoff(0, mmw_freeze
), 0);
1071 #ifdef WIRELESS_EXT /* if wireless extension exists in the kernel */
1072 /* Don't forget to update statistics */
1073 lp
->wstats
.discard
.nwid
+= (m
.mmr_wrong_nwid_h
<< 8) | m
.mmr_wrong_nwid_l
;
1074 #endif /* WIRELESS_EXT */
1076 printk(KERN_DEBUG
"##### WaveLAN modem status registers: #####\n");
1077 #ifdef DEBUG_SHOW_UNUSED
1078 printk(KERN_DEBUG
"mmc_unused0[]: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
1087 #endif /* DEBUG_SHOW_UNUSED */
1088 printk(KERN_DEBUG
"Encryption algorithm: %02X - Status: %02X\n",
1089 m
.mmr_des_avail
, m
.mmr_des_status
);
1090 #ifdef DEBUG_SHOW_UNUSED
1091 printk(KERN_DEBUG
"mmc_unused1[]: %02X:%02X:%02X:%02X:%02X\n",
1097 #endif /* DEBUG_SHOW_UNUSED */
1098 printk(KERN_DEBUG
"dce_status: 0x%x [%s%s%s%s]\n",
1100 (m
.mmr_dce_status
& MMR_DCE_STATUS_RX_BUSY
) ? "energy detected,":"",
1101 (m
.mmr_dce_status
& MMR_DCE_STATUS_LOOPT_IND
) ?
1102 "loop test indicated," : "",
1103 (m
.mmr_dce_status
& MMR_DCE_STATUS_TX_BUSY
) ? "transmitter on," : "",
1104 (m
.mmr_dce_status
& MMR_DCE_STATUS_JBR_EXPIRED
) ?
1105 "jabber timer expired," : "");
1106 printk(KERN_DEBUG
"Dsp ID: %02X\n",
1108 #ifdef DEBUG_SHOW_UNUSED
1109 printk(KERN_DEBUG
"mmc_unused2[]: %02X:%02X\n",
1112 #endif /* DEBUG_SHOW_UNUSED */
1113 printk(KERN_DEBUG
"# correct_nwid: %d, # wrong_nwid: %d\n",
1114 (m
.mmr_correct_nwid_h
<< 8) | m
.mmr_correct_nwid_l
,
1115 (m
.mmr_wrong_nwid_h
<< 8) | m
.mmr_wrong_nwid_l
);
1116 printk(KERN_DEBUG
"thr_pre_set: 0x%x [current signal %s]\n",
1117 m
.mmr_thr_pre_set
& MMR_THR_PRE_SET
,
1118 (m
.mmr_thr_pre_set
& MMR_THR_PRE_SET_CUR
) ? "above" : "below");
1119 printk(KERN_DEBUG
"signal_lvl: %d [%s], ",
1120 m
.mmr_signal_lvl
& MMR_SIGNAL_LVL
,
1121 (m
.mmr_signal_lvl
& MMR_SIGNAL_LVL_VALID
) ? "new msg" : "no new msg");
1122 printk("silence_lvl: %d [%s], ", m
.mmr_silence_lvl
& MMR_SILENCE_LVL
,
1123 (m
.mmr_silence_lvl
& MMR_SILENCE_LVL_VALID
) ? "update done" : "no new update");
1124 printk("sgnl_qual: 0x%x [%s]\n",
1125 m
.mmr_sgnl_qual
& MMR_SGNL_QUAL
,
1126 (m
.mmr_sgnl_qual
& MMR_SGNL_QUAL_ANT
) ? "Antenna 1" : "Antenna 0");
1127 #ifdef DEBUG_SHOW_UNUSED
1128 printk(KERN_DEBUG
"netw_id_l: %x\n", m
.mmr_netw_id_l
);
1129 #endif /* DEBUG_SHOW_UNUSED */
1131 #endif /* DEBUG_MMC_SHOW */
1133 #ifdef DEBUG_I82586_SHOW
1134 /*------------------------------------------------------------------*/
1136 * Print the last block of the i82586 memory.
1139 wv_scb_show(u_long ioaddr
)
1143 obram_read(ioaddr
, OFFSET_SCB
, (unsigned char *)&scb
, sizeof(scb
));
1145 printk(KERN_DEBUG
"##### WaveLAN system control block: #####\n");
1147 printk(KERN_DEBUG
"status: ");
1148 printk("stat 0x%x[%s%s%s%s] ",
1149 (scb
.scb_status
& (SCB_ST_CX
| SCB_ST_FR
| SCB_ST_CNA
| SCB_ST_RNR
)) >> 12,
1150 (scb
.scb_status
& SCB_ST_CX
) ? "command completion interrupt," : "",
1151 (scb
.scb_status
& SCB_ST_FR
) ? "frame received," : "",
1152 (scb
.scb_status
& SCB_ST_CNA
) ? "command unit not active," : "",
1153 (scb
.scb_status
& SCB_ST_RNR
) ? "receiving unit not ready," : "");
1154 printk("cus 0x%x[%s%s%s] ",
1155 (scb
.scb_status
& SCB_ST_CUS
) >> 8,
1156 ((scb
.scb_status
& SCB_ST_CUS
) == SCB_ST_CUS_IDLE
) ? "idle" : "",
1157 ((scb
.scb_status
& SCB_ST_CUS
) == SCB_ST_CUS_SUSP
) ? "suspended" : "",
1158 ((scb
.scb_status
& SCB_ST_CUS
) == SCB_ST_CUS_ACTV
) ? "active" : "");
1159 printk("rus 0x%x[%s%s%s%s]\n",
1160 (scb
.scb_status
& SCB_ST_RUS
) >> 4,
1161 ((scb
.scb_status
& SCB_ST_RUS
) == SCB_ST_RUS_IDLE
) ? "idle" : "",
1162 ((scb
.scb_status
& SCB_ST_RUS
) == SCB_ST_RUS_SUSP
) ? "suspended" : "",
1163 ((scb
.scb_status
& SCB_ST_RUS
) == SCB_ST_RUS_NRES
) ? "no resources" : "",
1164 ((scb
.scb_status
& SCB_ST_RUS
) == SCB_ST_RUS_RDY
) ? "ready" : "");
1166 printk(KERN_DEBUG
"command: ");
1167 printk("ack 0x%x[%s%s%s%s] ",
1168 (scb
.scb_command
& (SCB_CMD_ACK_CX
| SCB_CMD_ACK_FR
| SCB_CMD_ACK_CNA
| SCB_CMD_ACK_RNR
)) >> 12,
1169 (scb
.scb_command
& SCB_CMD_ACK_CX
) ? "ack cmd completion," : "",
1170 (scb
.scb_command
& SCB_CMD_ACK_FR
) ? "ack frame received," : "",
1171 (scb
.scb_command
& SCB_CMD_ACK_CNA
) ? "ack CU not active," : "",
1172 (scb
.scb_command
& SCB_CMD_ACK_RNR
) ? "ack RU not ready," : "");
1173 printk("cuc 0x%x[%s%s%s%s%s] ",
1174 (scb
.scb_command
& SCB_CMD_CUC
) >> 8,
1175 ((scb
.scb_command
& SCB_CMD_CUC
) == SCB_CMD_CUC_NOP
) ? "nop" : "",
1176 ((scb
.scb_command
& SCB_CMD_CUC
) == SCB_CMD_CUC_GO
) ? "start cbl_offset" : "",
1177 ((scb
.scb_command
& SCB_CMD_CUC
) == SCB_CMD_CUC_RES
) ? "resume execution" : "",
1178 ((scb
.scb_command
& SCB_CMD_CUC
) == SCB_CMD_CUC_SUS
) ? "suspend execution" : "",
1179 ((scb
.scb_command
& SCB_CMD_CUC
) == SCB_CMD_CUC_ABT
) ? "abort execution" : "");
1180 printk("ruc 0x%x[%s%s%s%s%s]\n",
1181 (scb
.scb_command
& SCB_CMD_RUC
) >> 4,
1182 ((scb
.scb_command
& SCB_CMD_RUC
) == SCB_CMD_RUC_NOP
) ? "nop" : "",
1183 ((scb
.scb_command
& SCB_CMD_RUC
) == SCB_CMD_RUC_GO
) ? "start rfa_offset" : "",
1184 ((scb
.scb_command
& SCB_CMD_RUC
) == SCB_CMD_RUC_RES
) ? "resume reception" : "",
1185 ((scb
.scb_command
& SCB_CMD_RUC
) == SCB_CMD_RUC_SUS
) ? "suspend reception" : "",
1186 ((scb
.scb_command
& SCB_CMD_RUC
) == SCB_CMD_RUC_ABT
) ? "abort reception" : "");
1188 printk(KERN_DEBUG
"cbl_offset 0x%x ", scb
.scb_cbl_offset
);
1189 printk("rfa_offset 0x%x\n", scb
.scb_rfa_offset
);
1191 printk(KERN_DEBUG
"crcerrs %d ", scb
.scb_crcerrs
);
1192 printk("alnerrs %d ", scb
.scb_alnerrs
);
1193 printk("rscerrs %d ", scb
.scb_rscerrs
);
1194 printk("ovrnerrs %d\n", scb
.scb_ovrnerrs
);
1197 /*------------------------------------------------------------------*/
1199 * Print the formatted status of the i82586's receive unit.
1202 wv_ru_show(device
* dev
)
1204 /* net_local *lp = (net_local *) dev->priv; */
1206 printk(KERN_DEBUG
"##### WaveLAN i82586 receiver unit status: #####\n");
1207 printk(KERN_DEBUG
"ru:");
1209 * Not implemented yet
1214 /*------------------------------------------------------------------*/
1216 * Display info about one control block of the i82586 memory.
1219 wv_cu_show_one(device
* dev
,
1227 ioaddr
= dev
->base_addr
;
1229 printk("%d: 0x%x:", i
, p
);
1231 obram_read(ioaddr
, p
, (unsigned char *)&actx
, sizeof(actx
));
1232 printk(" status=0x%x,", actx
.tx_h
.ac_status
);
1233 printk(" command=0x%x,", actx
.tx_h
.ac_command
);
1239 obram_read(ioaddr, actx.tx_tbd_offset, (unsigned char *)&tbd, sizeof(tbd));
1240 printk(" tbd_status=0x%x,", tbd.tbd_status);
1247 /*------------------------------------------------------------------*/
1249 * Print status of the command unit of the i82586.
1252 wv_cu_show(device
* dev
)
1254 net_local
* lp
= (net_local
*)dev
->priv
;
1258 printk(KERN_DEBUG
"##### WaveLAN i82586 command unit status: #####\n");
1261 for(i
= 0, p
= lp
->tx_first_in_use
; i
< NTXBLOCKS
; i
++)
1263 wv_cu_show_one(dev
, lp
, i
, p
);
1266 if(p
>= OFFSET_CU
+ NTXBLOCKS
* TXBLOCKZ
)
1267 p
-= NTXBLOCKS
* TXBLOCKZ
;
1271 #endif /* DEBUG_I82586_SHOW */
1273 #ifdef DEBUG_DEVICE_SHOW
1274 /*------------------------------------------------------------------*/
1276 * Print the formatted status of the WaveLAN PCMCIA device driver.
1279 wv_dev_show(device
* dev
)
1281 printk(KERN_DEBUG
"dev:");
1282 printk(" start=%d,", dev
->start
);
1283 printk(" tbusy=%ld,", dev
->tbusy
);
1284 printk(" interrupt=%d,", dev
->interrupt
);
1285 printk(" trans_start=%ld,", dev
->trans_start
);
1286 printk(" flags=0x%x,", dev
->flags
);
1290 /*------------------------------------------------------------------*/
1292 * Print the formatted status of the WaveLAN PCMCIA device driver's
1293 * private information.
1296 wv_local_show(device
* dev
)
1300 lp
= (net_local
*)dev
->priv
;
1302 printk(KERN_DEBUG
"local:");
1303 printk(" tx_n_in_use=%d,", lp
->tx_n_in_use
);
1304 printk(" hacr=0x%x,", lp
->hacr
);
1305 printk(" rx_head=0x%x,", lp
->rx_head
);
1306 printk(" rx_last=0x%x,", lp
->rx_last
);
1307 printk(" tx_first_free=0x%x,", lp
->tx_first_free
);
1308 printk(" tx_first_in_use=0x%x,", lp
->tx_first_in_use
);
1310 } /* wv_local_show */
1311 #endif /* DEBUG_DEVICE_SHOW */
1313 #if defined(DEBUG_RX_INFO) || defined(DEBUG_TX_INFO)
1314 /*------------------------------------------------------------------*/
1316 * Dump packet header (and content if necessary) on the screen
1319 wv_packet_info(u_char
* p
, /* Packet to dump */
1320 int length
, /* Length of the packet */
1321 char * msg1
, /* Name of the device */
1322 char * msg2
) /* Name of the function */
1327 printk(KERN_DEBUG
"%s: %s(): dest %02X:%02X:%02X:%02X:%02X:%02X, length %d\n",
1328 msg1
, msg2
, p
[0], p
[1], p
[2], p
[3], p
[4], p
[5], length
);
1329 printk(KERN_DEBUG
"%s: %s(): src %02X:%02X:%02X:%02X:%02X:%02X, type 0x%02X%02X\n",
1330 msg1
, msg2
, p
[6], p
[7], p
[8], p
[9], p
[10], p
[11], p
[12], p
[13]);
1332 #ifdef DEBUG_PACKET_DUMP
1334 printk(KERN_DEBUG
"data=\"");
1336 if((maxi
= length
) > DEBUG_PACKET_DUMP
)
1337 maxi
= DEBUG_PACKET_DUMP
;
1338 for(i
= 14; i
< maxi
; i
++)
1339 if(p
[i
] >= ' ' && p
[i
] <= '~')
1340 printk(" %c", p
[i
]);
1342 printk("%02X", p
[i
]);
1346 printk(KERN_DEBUG
"\n");
1347 #endif /* DEBUG_PACKET_DUMP */
1349 #endif /* defined(DEBUG_RX_INFO) || defined(DEBUG_TX_INFO) */
1351 /*------------------------------------------------------------------*/
1353 * This is the information which is displayed by the driver at startup.
1354 * There are lots of flags for configuring it to your liking.
1357 wv_init_info(device
* dev
)
1359 short ioaddr
= dev
->base_addr
;
1360 net_local
* lp
= (net_local
*)dev
->priv
;
1364 /* Read the parameter storage area */
1365 psa_read(ioaddr
, lp
->hacr
, 0, (unsigned char *) &psa
, sizeof(psa
));
1367 #ifdef DEBUG_PSA_SHOW
1370 #ifdef DEBUG_MMC_SHOW
1373 #ifdef DEBUG_I82586_SHOW
1377 #ifdef DEBUG_BASIC_SHOW
1378 /* Now, let's go for the basic stuff. */
1379 printk(KERN_NOTICE
"%s: WaveLAN at %#x,", dev
->name
, ioaddr
);
1380 for(i
= 0; i
< WAVELAN_ADDR_SIZE
; i
++)
1381 printk("%s%02X", (i
== 0) ? " " : ":", dev
->dev_addr
[i
]);
1382 printk(", IRQ %d", dev
->irq
);
1384 /* Print current network ID. */
1385 if(psa
.psa_nwid_select
)
1386 printk(", nwid 0x%02X-%02X", psa
.psa_nwid
[0], psa
.psa_nwid
[1]);
1388 printk(", nwid off");
1391 if(!(mmc_in(ioaddr
, mmroff(0, mmr_fee_status
)) &
1392 (MMR_FEE_STATUS_DWLD
| MMR_FEE_STATUS_BUSY
)))
1394 unsigned short freq
;
1396 /* Ask the EEPROM to read the frequency from the first area. */
1397 fee_read(ioaddr
, 0x00, &freq
, 1);
1399 /* Print frequency */
1400 printk(", 2.00, %ld", (freq
>> 6) + 2400L);
1409 switch(psa
.psa_comp_number
)
1411 case PSA_COMP_PC_AT_915
:
1412 case PSA_COMP_PC_AT_2400
:
1415 case PSA_COMP_PC_MC_915
:
1416 case PSA_COMP_PC_MC_2400
:
1419 case PSA_COMP_PCMCIA_915
:
1426 switch (psa
.psa_subband
)
1428 case PSA_SUBBAND_915
:
1431 case PSA_SUBBAND_2425
:
1434 case PSA_SUBBAND_2460
:
1437 case PSA_SUBBAND_2484
:
1440 case PSA_SUBBAND_2430_5
:
1449 #endif /* DEBUG_BASIC_SHOW */
1451 #ifdef DEBUG_VERSION_SHOW
1452 /* Print version information */
1453 printk(KERN_NOTICE
"%s", version
);
1455 } /* wv_init_info */
1457 /********************* IOCTL, STATS & RECONFIG *********************/
1459 * We found here routines that are called by Linux on different
1460 * occasions after the configuration and not for transmitting data
1461 * These may be called when the user use ifconfig, /proc/net/dev
1462 * or wireless extensions
1465 /*------------------------------------------------------------------*/
1467 * Get the current Ethernet statistics. This may be called with the
1468 * card open or closed.
1469 * Used when the user read /proc/net/dev
1472 wavelan_get_stats(device
* dev
)
1474 #ifdef DEBUG_IOCTL_TRACE
1475 printk(KERN_DEBUG
"%s: <>wavelan_get_stats()\n", dev
->name
);
1478 return(&((net_local
*) dev
->priv
)->stats
);
1481 /*------------------------------------------------------------------*/
1483 * Set or clear the multicast filter for this adaptor.
1484 * num_addrs == -1 Promiscuous mode, receive all packets
1485 * num_addrs == 0 Normal mode, clear multicast list
1486 * num_addrs > 0 Multicast mode, receive normal and MC packets,
1487 * and do best-effort filtering.
1490 wavelan_set_multicast_list(device
* dev
)
1492 net_local
* lp
= (net_local
*) dev
->priv
;
1494 #ifdef DEBUG_IOCTL_TRACE
1495 printk(KERN_DEBUG
"%s: ->wavelan_set_multicast_list()\n", dev
->name
);
1498 #ifdef DEBUG_IOCTL_INFO
1499 printk(KERN_DEBUG
"%s: wavelan_set_multicast_list(): setting Rx mode %02X to %d addresses.\n",
1500 dev
->name
, dev
->flags
, dev
->mc_count
);
1503 /* Are we asking for promiscuous mode,
1504 * or all multicast addresses (we don't have that!)
1505 * or too many multicast addresses for the hardware filter? */
1506 if((dev
->flags
& IFF_PROMISC
) ||
1507 (dev
->flags
& IFF_ALLMULTI
) ||
1508 (dev
->mc_count
> I82586_MAX_MULTICAST_ADDRESSES
))
1511 * Enable promiscuous mode: receive all packets.
1513 if(!lp
->promiscuous
)
1515 lp
->promiscuous
= 1;
1518 wv_82586_reconfig(dev
);
1520 /* Tell the kernel that we are doing a really bad job. */
1521 dev
->flags
|= IFF_PROMISC
;
1525 /* Are there multicast addresses to send? */
1526 if(dev
->mc_list
!= (struct dev_mc_list
*) NULL
)
1529 * Disable promiscuous mode, but receive all packets
1532 #ifdef MULTICAST_AVOID
1533 if(lp
->promiscuous
||
1534 (dev
->mc_count
!= lp
->mc_count
))
1537 lp
->promiscuous
= 0;
1538 lp
->mc_count
= dev
->mc_count
;
1540 wv_82586_reconfig(dev
);
1546 * Switch to normal mode: disable promiscuous mode and
1547 * clear the multicast list.
1549 if(lp
->promiscuous
|| lp
->mc_count
== 0)
1551 lp
->promiscuous
= 0;
1554 wv_82586_reconfig(dev
);
1557 #ifdef DEBUG_IOCTL_TRACE
1558 printk(KERN_DEBUG
"%s: <-wavelan_set_multicast_list()\n", dev
->name
);
1562 /*------------------------------------------------------------------*/
1564 * This function doesn't exist.
1565 * (Note : it was a nice way to test the reconfigure stuff...)
1567 #ifdef SET_MAC_ADDRESS
1569 wavelan_set_mac_address(device
* dev
,
1572 struct sockaddr
* mac
= addr
;
1574 /* Copy the address. */
1575 memcpy(dev
->dev_addr
, mac
->sa_data
, WAVELAN_ADDR_SIZE
);
1577 /* Reconfigure the beast. */
1578 wv_82586_reconfig(dev
);
1582 #endif /* SET_MAC_ADDRESS */
1584 #ifdef WIRELESS_EXT /* if wireless extensions exist in the kernel */
1586 /*------------------------------------------------------------------*/
1588 * Frequency setting (for hardware capable of it)
1589 * It's a bit complicated and you don't really want to look into it.
1590 * (called in wavelan_ioctl)
1593 wv_set_frequency(u_long ioaddr
, /* I/O port of the card */
1594 iw_freq
* frequency
)
1596 const int BAND_NUM
= 10; /* Number of bands */
1597 long freq
= 0L; /* offset to 2.4 GHz in .5 MHz */
1598 #ifdef DEBUG_IOCTL_INFO
1602 /* Setting by frequency */
1603 /* Theoretically, you may set any frequency between
1604 * the two limits with a 0.5 MHz precision. In practice,
1605 * I don't want you to have trouble with local regulations.
1607 if((frequency
->e
== 1) &&
1608 (frequency
->m
>= (int) 2.412e8
) && (frequency
->m
<= (int) 2.487e8
))
1610 freq
= ((frequency
->m
/ 10000) - 24000L) / 5;
1613 /* Setting by channel (same as wfreqsel) */
1614 /* Warning: each channel is 22 MHz wide, so some of the channels
1615 * will interfere. */
1616 if((frequency
->e
== 0) &&
1617 (frequency
->m
>= 0) && (frequency
->m
< BAND_NUM
))
1619 /* Get frequency offset. */
1620 freq
= channel_bands
[frequency
->m
] >> 1;
1623 /* Verify that the frequency is allowed. */
1626 u_short table
[10]; /* Authorized frequency table */
1628 /* Read the frequency table. */
1629 fee_read(ioaddr
, 0x71, table
, 10);
1631 #ifdef DEBUG_IOCTL_INFO
1632 printk(KERN_DEBUG
"Frequency table: ");
1633 for(i
= 0; i
< 10; i
++)
1641 /* Look in the table to see whether the frequency is allowed. */
1642 if(!(table
[9 - ((freq
- 24) / 16)] &
1643 (1 << ((freq
- 24) % 16))))
1644 return -EINVAL
; /* not allowed */
1649 /* if we get a usable frequency */
1652 unsigned short area
[16];
1653 unsigned short dac
[2];
1654 unsigned short area_verify
[16];
1655 unsigned short dac_verify
[2];
1656 /* Corresponding gain (in the power adjust value table)
1657 * See AT&T WaveLAN Data Manual, REF 407-024689/E, page 3-8
1658 * and WCIN062D.DOC, page 6.2.9. */
1659 unsigned short power_limit
[] = { 40, 80, 120, 160, 0 };
1660 int power_band
= 0; /* Selected band */
1661 unsigned short power_adjust
; /* Correct value */
1663 /* Search for the gain. */
1665 while((freq
> power_limit
[power_band
]) &&
1666 (power_limit
[++power_band
] != 0))
1669 /* Read the first area. */
1670 fee_read(ioaddr
, 0x00, area
, 16);
1673 fee_read(ioaddr
, 0x60, dac
, 2);
1675 /* Read the new power adjust value. */
1676 fee_read(ioaddr
, 0x6B - (power_band
>> 1), &power_adjust
, 1);
1677 if(power_band
& 0x1)
1680 power_adjust
&= 0xFF;
1682 #ifdef DEBUG_IOCTL_INFO
1683 printk(KERN_DEBUG
"WaveLAN EEPROM Area 1: ");
1684 for(i
= 0; i
< 16; i
++)
1691 printk(KERN_DEBUG
"WaveLAN EEPROM DAC: %04X %04X\n",
1695 /* Frequency offset (for info only) */
1696 area
[0] = ((freq
<< 5) & 0xFFE0) | (area
[0] & 0x1F);
1698 /* Receiver Principle main divider coefficient */
1699 area
[3] = (freq
>> 1) + 2400L - 352L;
1700 area
[2] = ((freq
& 0x1) << 4) | (area
[2] & 0xFFEF);
1702 /* Transmitter Main divider coefficient */
1703 area
[13] = (freq
>> 1) + 2400L;
1704 area
[12] = ((freq
& 0x1) << 4) | (area
[2] & 0xFFEF);
1706 /* Other parts of the area are flags, bit streams or unused. */
1708 /* Set the value in the DAC. */
1709 dac
[1] = ((power_adjust
>> 1) & 0x7F) | (dac
[1] & 0xFF80);
1710 dac
[0] = ((power_adjust
& 0x1) << 4) | (dac
[0] & 0xFFEF);
1712 /* Write the first area. */
1713 fee_write(ioaddr
, 0x00,
1716 /* Write the DAC. */
1717 fee_write(ioaddr
, 0x60,
1720 /* We now should verify here that the writing of the EEPROM went OK. */
1722 /* Reread the first area. */
1723 fee_read(ioaddr
, 0x00, area_verify
, 16);
1725 /* Reread the DAC. */
1726 fee_read(ioaddr
, 0x60, dac_verify
, 2);
1729 if(memcmp(area
, area_verify
, 16 * 2) ||
1730 memcmp(dac
, dac_verify
, 2 * 2))
1732 #ifdef DEBUG_IOCTL_ERROR
1733 printk(KERN_INFO
"WaveLAN: wv_set_frequency: unable to write new frequency to EEPROM(?).\n");
1738 /* We must download the frequency parameters to the
1739 * synthesizers (from the EEPROM - area 1)
1740 * Note: as the EEPROM is automatically decremented, we set the end
1742 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), 0x0F);
1743 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
),
1744 MMW_FEE_CTRL_READ
| MMW_FEE_CTRL_DWLD
);
1746 /* Wait until the download is finished. */
1747 fee_wait(ioaddr
, 100, 100);
1749 /* We must now download the power adjust value (gain) to
1750 * the synthesizers (from the EEPROM - area 7 - DAC). */
1751 mmc_out(ioaddr
, mmwoff(0, mmw_fee_addr
), 0x61);
1752 mmc_out(ioaddr
, mmwoff(0, mmw_fee_ctrl
),
1753 MMW_FEE_CTRL_READ
| MMW_FEE_CTRL_DWLD
);
1755 /* Wait for the download to finish. */
1756 fee_wait(ioaddr
, 100, 100);
1758 #ifdef DEBUG_IOCTL_INFO
1759 /* Verification of what we have done */
1761 printk(KERN_DEBUG
"WaveLAN EEPROM Area 1: ");
1762 for(i
= 0; i
< 16; i
++)
1769 printk(KERN_DEBUG
"WaveLAN EEPROM DAC: %04X %04X\n",
1770 dac_verify
[0], dac_verify
[1]);
1776 return -EINVAL
; /* Bah, never get there... */
1779 /*------------------------------------------------------------------*/
1781 * Give the list of available frequencies.
1784 wv_frequency_list(u_long ioaddr
, /* I/O port of the card */
1785 iw_freq
* list
, /* List of frequencies to fill */
1786 int max
) /* Maximum number of frequencies */
1788 u_short table
[10]; /* Authorized frequency table */
1789 long freq
= 0L; /* offset to 2.4 GHz in .5 MHz + 12 MHz */
1790 int i
; /* index in the table */
1791 int c
= 0; /* Channel number */
1793 /* Read the frequency table. */
1794 fee_read(ioaddr
, 0x71 /* frequency table */, table
, 10);
1796 /* Check all frequencies. */
1798 for(freq
= 0; freq
< 150; freq
++)
1799 /* Look in the table if the frequency is allowed */
1800 if(table
[9 - (freq
/ 16)] & (1 << (freq
% 16)))
1802 /* Compute approximate channel number */
1803 while((((channel_bands
[c
] >> 1) - 24) < freq
) &&
1804 (c
< NELS(channel_bands
)))
1806 list
[i
].i
= c
; /* Set the list index */
1808 /* put in the list */
1809 list
[i
].m
= (((freq
+ 24) * 5) + 24000L) * 10000;
1821 /*------------------------------------------------------------------*/
1823 * Gather wireless spy statistics: for each packet, compare the source
1824 * address with our list, and if they match, get the statistics.
1825 * Sorry, but this function really needs the wireless extensions.
1828 wl_spy_gather(device
* dev
,
1829 u_char
* mac
, /* MAC address */
1830 u_char
* stats
) /* Statistics to gather */
1832 net_local
* lp
= (net_local
*) dev
->priv
;
1835 /* Check all addresses. */
1836 for(i
= 0; i
< lp
->spy_number
; i
++)
1838 if(!memcmp(mac
, lp
->spy_address
[i
], WAVELAN_ADDR_SIZE
))
1840 /* Update statistics */
1841 lp
->spy_stat
[i
].qual
= stats
[2] & MMR_SGNL_QUAL
;
1842 lp
->spy_stat
[i
].level
= stats
[0] & MMR_SIGNAL_LVL
;
1843 lp
->spy_stat
[i
].noise
= stats
[1] & MMR_SILENCE_LVL
;
1844 lp
->spy_stat
[i
].updated
= 0x7;
1847 #endif /* WIRELESS_SPY */
1850 /*------------------------------------------------------------------*/
1852 * This function calculates a histogram of the signal level.
1853 * As the noise is quite constant, it's like doing it on the SNR.
1854 * We have defined a set of interval (lp->his_range), and each time
1855 * the level goes in that interval, we increment the count (lp->his_sum).
1856 * With this histogram you may detect if one WaveLAN is really weak,
1857 * or you may also calculate the mean and standard deviation of the level.
1860 wl_his_gather(device
* dev
,
1861 u_char
* stats
) /* Statistics to gather */
1863 net_local
* lp
= (net_local
*) dev
->priv
;
1864 u_char level
= stats
[0] & MMR_SIGNAL_LVL
;
1867 /* Find the correct interval. */
1869 while((i
< (lp
->his_number
- 1)) && (level
>= lp
->his_range
[i
++]))
1872 /* Increment interval counter. */
1875 #endif /* HISTOGRAM */
1877 /*------------------------------------------------------------------*/
1879 * Perform ioctl for configuration and information.
1880 * It is here that the wireless extensions are treated (iwconfig).
1883 wavelan_ioctl(struct net_device
* dev
, /* device on which the ioctl is applied */
1884 struct ifreq
* rq
, /* data passed */
1885 int cmd
) /* ioctl number */
1887 u_long ioaddr
= dev
->base_addr
;
1888 net_local
* lp
= (net_local
*)dev
->priv
; /* lp is not unused */
1889 struct iwreq
* wrq
= (struct iwreq
*) rq
;
1895 #ifdef DEBUG_IOCTL_TRACE
1896 printk(KERN_DEBUG
"%s: ->wavelan_ioctl(cmd=0x%X)\n", dev
->name
, cmd
);
1899 /* Disable interrupts and save flags. */
1902 /* Look what is the request */
1905 /* --------------- WIRELESS EXTENSIONS --------------- */
1908 strcpy(wrq
->u
.name
, "WaveLAN");
1912 /* Set NWID in WaveLAN. */
1915 /* Set NWID in psa. */
1916 psa
.psa_nwid
[0] = (wrq
->u
.nwid
.nwid
& 0xFF00) >> 8;
1917 psa
.psa_nwid
[1] = wrq
->u
.nwid
.nwid
& 0xFF;
1918 psa
.psa_nwid_select
= 0x01;
1919 psa_write(ioaddr
, lp
->hacr
, (char *)psa
.psa_nwid
- (char *)&psa
,
1920 (unsigned char *)psa
.psa_nwid
, 3);
1922 /* Set NWID in mmc. */
1923 m
.w
.mmw_netw_id_l
= wrq
->u
.nwid
.nwid
& 0xFF;
1924 m
.w
.mmw_netw_id_h
= (wrq
->u
.nwid
.nwid
& 0xFF00) >> 8;
1925 mmc_write(ioaddr
, (char *)&m
.w
.mmw_netw_id_l
- (char *)&m
,
1926 (unsigned char *)&m
.w
.mmw_netw_id_l
, 2);
1927 mmc_out(ioaddr
, mmwoff(0, mmw_loopt_sel
), 0x00);
1931 /* Disable NWID in the psa. */
1932 psa
.psa_nwid_select
= 0x00;
1933 psa_write(ioaddr
, lp
->hacr
,
1934 (char *)&psa
.psa_nwid_select
- (char *)&psa
,
1935 (unsigned char *)&psa
.psa_nwid_select
, 1);
1937 /* Disable NWID in the mmc (no filtering). */
1938 mmc_out(ioaddr
, mmwoff(0, mmw_loopt_sel
), MMW_LOOPT_SEL_DIS_NWID
);
1940 /* update the Wavelan checksum */
1941 update_psa_checksum(dev
, ioaddr
, lp
->hacr
);
1945 /* Read the NWID. */
1946 psa_read(ioaddr
, lp
->hacr
, (char *)psa
.psa_nwid
- (char *)&psa
,
1947 (unsigned char *)psa
.psa_nwid
, 3);
1948 wrq
->u
.nwid
.nwid
= (psa
.psa_nwid
[0] << 8) + psa
.psa_nwid
[1];
1949 wrq
->u
.nwid
.on
= psa
.psa_nwid_select
;
1953 /* Attempt to recognise 2.00 cards (2.4 GHz frequency selectable). */
1954 if(!(mmc_in(ioaddr
, mmroff(0, mmr_fee_status
)) &
1955 (MMR_FEE_STATUS_DWLD
| MMR_FEE_STATUS_BUSY
)))
1956 ret
= wv_set_frequency(ioaddr
, &(wrq
->u
.freq
));
1962 /* Attempt to recognise 2.00 cards (2.4 GHz frequency selectable).
1963 * Does it work for everybody, especially old cards? */
1964 if(!(mmc_in(ioaddr
, mmroff(0, mmr_fee_status
)) &
1965 (MMR_FEE_STATUS_DWLD
| MMR_FEE_STATUS_BUSY
)))
1967 unsigned short freq
;
1969 /* Ask the EEPROM to read the frequency from the first area. */
1970 fee_read(ioaddr
, 0x00, &freq
, 1);
1971 wrq
->u
.freq
.m
= ((freq
>> 5) * 5 + 24000L) * 10000;
1976 psa_read(ioaddr
, lp
->hacr
, (char *)&psa
.psa_subband
- (char *)&psa
,
1977 (unsigned char *)&psa
.psa_subband
, 1);
1979 if(psa
.psa_subband
<= 4)
1981 wrq
->u
.freq
.m
= fixed_bands
[psa
.psa_subband
];
1982 wrq
->u
.freq
.e
= (psa
.psa_subband
!= 0);
1990 /* Set the level threshold. */
1991 /* We should complain loudly if wrq->u.sens.fixed = 0, because we
1992 * can't set auto mode... */
1993 psa
.psa_thr_pre_set
= wrq
->u
.sens
.value
& 0x3F;
1994 psa_write(ioaddr
, lp
->hacr
, (char *)&psa
.psa_thr_pre_set
- (char *)&psa
,
1995 (unsigned char *) &psa
.psa_thr_pre_set
, 1);
1996 /* update the Wavelan checksum */
1997 update_psa_checksum(dev
, ioaddr
, lp
->hacr
);
1998 mmc_out(ioaddr
, mmwoff(0, mmw_thr_pre_set
), psa
.psa_thr_pre_set
);
2002 /* Read the level threshold. */
2003 psa_read(ioaddr
, lp
->hacr
, (char *)&psa
.psa_thr_pre_set
- (char *)&psa
,
2004 (unsigned char *) &psa
.psa_thr_pre_set
, 1);
2005 wrq
->u
.sens
.value
= psa
.psa_thr_pre_set
& 0x3F;
2006 wrq
->u
.sens
.fixed
= 1;
2010 /* Set encryption key. */
2011 if(!mmc_encr(ioaddr
))
2017 if(wrq
->u
.encoding
.method
)
2018 { /* Enable encryption. */
2020 long long key
= wrq
->u
.encoding
.code
;
2022 for(i
= 7; i
>= 0; i
--)
2024 psa
.psa_encryption_key
[i
] = key
& 0xFF;
2027 psa
.psa_encryption_select
= 1;
2028 psa_write(ioaddr
, lp
->hacr
,
2029 (char *) &psa
.psa_encryption_select
- (char *) &psa
,
2030 (unsigned char *) &psa
.psa_encryption_select
, 8+1);
2032 mmc_out(ioaddr
, mmwoff(0, mmw_encr_enable
),
2033 MMW_ENCR_ENABLE_EN
| MMW_ENCR_ENABLE_MODE
);
2034 mmc_write(ioaddr
, mmwoff(0, mmw_encr_key
),
2035 (unsigned char *) &psa
.psa_encryption_key
, 8);
2038 { /* Disable encryption. */
2039 psa
.psa_encryption_select
= 0;
2040 psa_write(ioaddr
, lp
->hacr
,
2041 (char *) &psa
.psa_encryption_select
- (char *) &psa
,
2042 (unsigned char *) &psa
.psa_encryption_select
, 1);
2044 mmc_out(ioaddr
, mmwoff(0, mmw_encr_enable
), 0);
2046 /* update the Wavelan checksum */
2047 update_psa_checksum(dev
, ioaddr
, lp
->hacr
);
2051 /* Read the encryption key. */
2052 if(!mmc_encr(ioaddr
))
2058 /* Only super-user can see encryption key. */
2069 psa_read(ioaddr
, lp
->hacr
,
2070 (char *) &psa
.psa_encryption_select
- (char *) &psa
,
2071 (unsigned char *) &psa
.psa_encryption_select
, 1+8);
2072 for(i
= 0; i
< 8; i
++)
2075 key
+= psa
.psa_encryption_key
[i
];
2077 wrq
->u
.encoding
.code
= key
;
2079 /* encryption is enabled */
2080 if(psa
.psa_encryption_select
)
2081 wrq
->u
.encoding
.method
= mmc_encr(ioaddr
);
2083 wrq
->u
.encoding
.method
= 0;
2088 /* basic checking */
2089 if(wrq
->u
.data
.pointer
!= (caddr_t
) 0)
2091 struct iw_range range
;
2093 /* Set the length (useless: it's constant). */
2094 wrq
->u
.data
.length
= sizeof(struct iw_range
);
2096 /* Set information in the range struct. */
2097 range
.throughput
= 1.6 * 1000 * 1000; /* don't argue on this ! */
2098 range
.min_nwid
= 0x0000;
2099 range
.max_nwid
= 0xFFFF;
2101 /* Attempt to recognise 2.00 cards (2.4 GHz frequency selectable). */
2102 if(!(mmc_in(ioaddr
, mmroff(0, mmr_fee_status
)) &
2103 (MMR_FEE_STATUS_DWLD
| MMR_FEE_STATUS_BUSY
)))
2105 range
.num_channels
= 10;
2106 range
.num_frequency
= wv_frequency_list(ioaddr
, range
.freq
,
2107 IW_MAX_FREQUENCIES
);
2110 range
.num_channels
= range
.num_frequency
= 0;
2112 range
.sensitivity
= 0x3F;
2113 range
.max_qual
.qual
= MMR_SGNL_QUAL
;
2114 range
.max_qual
.level
= MMR_SIGNAL_LVL
;
2115 range
.max_qual
.noise
= MMR_SILENCE_LVL
;
2117 range
.num_bitrates
= 1;
2118 range
.bitrate
[0] = 2000000; /* 2 Mb/s */
2120 /* Copy structure to the user buffer. */
2121 if (copy_to_user(wrq
->u
.data
.pointer
, &range
, sizeof(struct iw_range
)))
2127 /* Basic checking */
2128 if(wrq
->u
.data
.pointer
!= (caddr_t
) 0)
2130 struct iw_priv_args priv
[] =
2131 { /* cmd, set_args, get_args, name */
2132 { SIOCSIPQTHR
, IW_PRIV_TYPE_BYTE
| IW_PRIV_SIZE_FIXED
| 1, 0, "setqualthr" },
2133 { SIOCGIPQTHR
, 0, IW_PRIV_TYPE_BYTE
| IW_PRIV_SIZE_FIXED
| 1, "getqualthr" },
2135 { SIOCSIPHISTO
, IW_PRIV_TYPE_BYTE
| 16, 0, "sethisto" },
2136 { SIOCGIPHISTO
, 0, IW_PRIV_TYPE_INT
| 16, "gethisto" },
2139 /* Set the number of available ioctls. */
2140 wrq
->u
.data
.length
= 4;
2142 /* Copy structure to the user buffer. */
2143 if (copy_to_user(wrq
->u
.data
.pointer
, (u_char
*) priv
, sizeof(priv
)))
2150 /* Set the spy list */
2152 /* Check the number of addresses. */
2153 if(wrq
->u
.data
.length
> IW_MAX_SPY
)
2158 lp
->spy_number
= wrq
->u
.data
.length
;
2160 /* Are there are addresses to copy? */
2161 if(lp
->spy_number
> 0)
2163 struct sockaddr address
[IW_MAX_SPY
];
2166 /* Copy addresses to the driver. */
2167 if (copy_from_user(address
, wrq
->u
.data
.pointer
, sizeof(struct sockaddr
) * lp
->spy_number
)) {
2172 /* Copy addresses to the lp structure. */
2173 for(i
= 0; i
< lp
->spy_number
; i
++)
2175 memcpy(lp
->spy_address
[i
], address
[i
].sa_data
,
2179 /* Reset structure. */
2180 memset(lp
->spy_stat
, 0x00, sizeof(iw_qual
) * IW_MAX_SPY
);
2182 #ifdef DEBUG_IOCTL_INFO
2183 printk(KERN_DEBUG
"SetSpy: set of new addresses is: \n");
2184 for(i
= 0; i
< wrq
->u
.data
.length
; i
++)
2185 printk(KERN_DEBUG
"%02X:%02X:%02X:%02X:%02X:%02X \n",
2186 lp
->spy_address
[i
][0],
2187 lp
->spy_address
[i
][1],
2188 lp
->spy_address
[i
][2],
2189 lp
->spy_address
[i
][3],
2190 lp
->spy_address
[i
][4],
2191 lp
->spy_address
[i
][5]);
2192 #endif /* DEBUG_IOCTL_INFO */
2198 /* Get the spy list and spy stats. */
2200 /* Set the number of addresses */
2201 wrq
->u
.data
.length
= lp
->spy_number
;
2203 /* Does the user want to have the addresses back? */
2204 if((lp
->spy_number
> 0) && (wrq
->u
.data
.pointer
!= (caddr_t
) 0))
2206 struct sockaddr address
[IW_MAX_SPY
];
2209 /* Copy addresses from the lp structure. */
2210 for(i
= 0; i
< lp
->spy_number
; i
++)
2212 memcpy(address
[i
].sa_data
, lp
->spy_address
[i
],
2214 address
[i
].sa_family
= AF_UNIX
;
2217 /* Copy addresses to the user buffer. */
2218 if (copy_to_user(wrq
->u
.data
.pointer
, address
, sizeof(struct sockaddr
) * lp
->spy_number
)) {
2223 /* Copy stats to the user buffer (just after). */
2224 if (copy_to_user(wrq
->u
.data
.pointer
+
2225 (sizeof(struct sockaddr
) * lp
->spy_number
),
2226 lp
->spy_stat
, sizeof(iw_qual
) * lp
->spy_number
)) {
2231 /* Reset updated flags. */
2232 for(i
= 0; i
< lp
->spy_number
; i
++)
2233 lp
->spy_stat
[i
].updated
= 0x0;
2234 } /* if(pointer != NULL) */
2237 #endif /* WIRELESS_SPY */
2239 /* ------------------ PRIVATE IOCTL ------------------ */
2247 psa
.psa_quality_thr
= *(wrq
->u
.name
) & 0x0F;
2248 psa_write(ioaddr
, lp
->hacr
, (char *)&psa
.psa_quality_thr
- (char *)&psa
,
2249 (unsigned char *)&psa
.psa_quality_thr
, 1);
2250 /* update the Wavelan checksum */
2251 update_psa_checksum(dev
, ioaddr
, lp
->hacr
);
2252 mmc_out(ioaddr
, mmwoff(0, mmw_quality_thr
), psa
.psa_quality_thr
);
2256 psa_read(ioaddr
, lp
->hacr
, (char *)&psa
.psa_quality_thr
- (char *)&psa
,
2257 (unsigned char *)&psa
.psa_quality_thr
, 1);
2258 *(wrq
->u
.name
) = psa
.psa_quality_thr
& 0x0F;
2263 /* Verify that the user is root. */
2270 /* Check the number of intervals. */
2271 if(wrq
->u
.data
.length
> 16)
2276 lp
->his_number
= wrq
->u
.data
.length
;
2278 /* Are there addresses to copy? */
2279 if(lp
->his_number
> 0)
2281 /* Copy interval ranges to the driver */
2282 if (copy_from_user(lp
->his_range
, wrq
->u
.data
.pointer
, sizeof(char) * lp
->his_number
)) {
2287 /* Reset structure. */
2288 memset(lp
->his_sum
, 0x00, sizeof(long) * 16);
2293 /* Set the number of intervals. */
2294 wrq
->u
.data
.length
= lp
->his_number
;
2296 /* Give back the distribution statistics */
2297 if((lp
->his_number
> 0) && (wrq
->u
.data
.pointer
!= (caddr_t
) 0))
2299 /* Copy data to the user buffer. */
2300 if (copy_to_user(wrq
->u
.data
.pointer
, lp
->his_sum
, sizeof(long) * lp
->his_number
))
2303 } /* if(pointer != NULL) */
2305 #endif /* HISTOGRAM */
2307 /* ------------------- OTHER IOCTL ------------------- */
2313 /* Enable interrupts and restore flags. */
2316 #ifdef DEBUG_IOCTL_TRACE
2317 printk(KERN_DEBUG
"%s: <-wavelan_ioctl()\n", dev
->name
);
2322 /*------------------------------------------------------------------*/
2324 * Get wireless statistics.
2325 * Called by /proc/net/wireless
2328 wavelan_get_wireless_stats(device
* dev
)
2330 u_long ioaddr
= dev
->base_addr
;
2331 net_local
* lp
= (net_local
*) dev
->priv
;
2336 #ifdef DEBUG_IOCTL_TRACE
2337 printk(KERN_DEBUG
"%s: ->wavelan_get_wireless_stats()\n", dev
->name
);
2340 /* Disable interrupts and save flags. */
2343 if(lp
== (net_local
*) NULL
)
2344 return (iw_stats
*) NULL
;
2345 wstats
= &lp
->wstats
;
2347 /* Get data from the mmc. */
2348 mmc_out(ioaddr
, mmwoff(0, mmw_freeze
), 1);
2350 mmc_read(ioaddr
, mmroff(0, mmr_dce_status
), &m
.mmr_dce_status
, 1);
2351 mmc_read(ioaddr
, mmroff(0, mmr_wrong_nwid_l
), &m
.mmr_wrong_nwid_l
, 2);
2352 mmc_read(ioaddr
, mmroff(0, mmr_thr_pre_set
), &m
.mmr_thr_pre_set
, 4);
2354 mmc_out(ioaddr
, mmwoff(0, mmw_freeze
), 0);
2356 /* Copy data to wireless stuff. */
2357 wstats
->status
= m
.mmr_dce_status
& MMR_DCE_STATUS
;
2358 wstats
->qual
.qual
= m
.mmr_sgnl_qual
& MMR_SGNL_QUAL
;
2359 wstats
->qual
.level
= m
.mmr_signal_lvl
& MMR_SIGNAL_LVL
;
2360 wstats
->qual
.noise
= m
.mmr_silence_lvl
& MMR_SILENCE_LVL
;
2361 wstats
->qual
.updated
= (((m
.mmr_signal_lvl
& MMR_SIGNAL_LVL_VALID
) >> 7) |
2362 ((m
.mmr_signal_lvl
& MMR_SIGNAL_LVL_VALID
) >> 6) |
2363 ((m
.mmr_silence_lvl
& MMR_SILENCE_LVL_VALID
) >> 5));
2364 wstats
->discard
.nwid
+= (m
.mmr_wrong_nwid_h
<< 8) | m
.mmr_wrong_nwid_l
;
2365 wstats
->discard
.code
= 0L;
2366 wstats
->discard
.misc
= 0L;
2368 /* Enable interrupts and restore flags. */
2371 #ifdef DEBUG_IOCTL_TRACE
2372 printk(KERN_DEBUG
"%s: <-wavelan_get_wireless_stats()\n", dev
->name
);
2376 #endif /* WIRELESS_EXT */
2378 /************************* PACKET RECEPTION *************************/
2380 * This part deals with receiving the packets.
2381 * The interrupt handler gets an interrupt when a packet has been
2382 * successfully received and calls this part.
2385 /*------------------------------------------------------------------*/
2387 * This routine does the actual copying of data (including the Ethernet
2388 * header structure) from the WaveLAN card to an sk_buff chain that
2389 * will be passed up to the network interface layer. NOTE: we
2390 * currently don't handle trailer protocols (neither does the rest of
2391 * the network interface), so if that is needed, it will (at least in
2392 * part) be added here. The contents of the receive ring buffer are
2393 * copied to a message chain that is then passed to the kernel.
2395 * Note: if any errors occur, the packet is "dropped on the floor".
2396 * (called by wv_packet_rcv())
2399 wv_packet_read(device
* dev
,
2403 net_local
* lp
= (net_local
*) dev
->priv
;
2404 u_long ioaddr
= dev
->base_addr
;
2405 struct sk_buff
* skb
;
2407 #ifdef DEBUG_RX_TRACE
2408 printk(KERN_DEBUG
"%s: ->wv_packet_read(0x%X, %d)\n",
2409 dev
->name
, buf_off
, sksize
);
2412 /* Allocate buffer for the data */
2413 if((skb
= dev_alloc_skb(sksize
)) == (struct sk_buff
*) NULL
)
2415 #ifdef DEBUG_RX_ERROR
2416 printk(KERN_INFO
"%s: wv_packet_read(): could not alloc_skb(%d, GFP_ATOMIC).\n",
2419 lp
->stats
.rx_dropped
++;
2425 /* Copy the packet to the buffer. */
2426 obram_read(ioaddr
, buf_off
, skb_put(skb
, sksize
), sksize
);
2427 skb
->protocol
=eth_type_trans(skb
, dev
);
2429 #ifdef DEBUG_RX_INFO
2430 wv_packet_info(skb
->mac
.raw
, sksize
, dev
->name
, "wv_packet_read");
2431 #endif /* DEBUG_RX_INFO */
2433 /* Statistics-gathering and associated stuff.
2434 * It seem a bit messy with all the define, but it's really simple... */
2435 #if defined(WIRELESS_SPY) || defined(HISTOGRAM)
2438 (lp
->spy_number
> 0) ||
2439 #endif /* WIRELESS_SPY */
2441 (lp
->his_number
> 0) ||
2442 #endif /* HISTOGRAM */
2445 u_char stats
[3]; /* signal level, noise level, signal quality */
2447 /* Read signal level, silence level and signal quality bytes. */
2448 /* Note: in the PCMCIA hardware, these are part of the frame. It seems
2449 * that for the ISA hardware, it's nowhere to be found in the frame,
2450 * so I'm obliged to do this (it has a side effect on /proc/net/wireless).
2453 mmc_out(ioaddr
, mmwoff(0, mmw_freeze
), 1);
2454 mmc_read(ioaddr
, mmroff(0, mmr_signal_lvl
), stats
, 3);
2455 mmc_out(ioaddr
, mmwoff(0, mmw_freeze
), 0);
2457 #ifdef DEBUG_RX_INFO
2458 printk(KERN_DEBUG
"%s: wv_packet_read(): Signal level %d/63, Silence level %d/63, signal quality %d/16\n",
2459 dev
->name
, stats
[0] & 0x3F, stats
[1] & 0x3F, stats
[2] & 0x0F);
2464 wl_spy_gather(dev
, skb
->mac
.raw
+ WAVELAN_ADDR_SIZE
, stats
);
2465 #endif /* WIRELESS_SPY */
2467 wl_his_gather(dev
, stats
);
2468 #endif /* HISTOGRAM */
2470 #endif /* defined(WIRELESS_SPY) || defined(HISTOGRAM) */
2473 * Hand the packet to the network module.
2477 /* Keep statistics up to date */
2478 lp
->stats
.rx_packets
++;
2479 lp
->stats
.rx_bytes
+= skb
->len
;
2481 #ifdef DEBUG_RX_TRACE
2482 printk(KERN_DEBUG
"%s: <-wv_packet_read()\n", dev
->name
);
2486 /*------------------------------------------------------------------*/
2488 * Transfer as many packets as we can
2489 * from the device RAM.
2490 * Called by the interrupt handler.
2493 wv_receive(device
* dev
)
2495 u_long ioaddr
= dev
->base_addr
;
2496 net_local
* lp
= (net_local
*)dev
->priv
;
2501 #ifdef DEBUG_RX_TRACE
2502 printk(KERN_DEBUG
"%s: ->wv_receive()\n", dev
->name
);
2505 /* Loop on each received packet. */
2508 obram_read(ioaddr
, lp
->rx_head
, (unsigned char *) &fd
, sizeof(fd
));
2510 /* Note about the status :
2511 * It start up to be 0 (the value we set). Then, when the RU
2512 * grab the buffer to prepare for reception, it sets the
2513 * FD_STATUS_B flag. When the RU has finished receiving the
2514 * frame, it clears FD_STATUS_B, set FD_STATUS_C to indicate
2515 * completion and set the other flags to indicate the eventual
2516 * errors. FD_STATUS_OK indicates that the reception was OK.
2519 /* If the current frame is not complete, we have reached the end. */
2520 if((fd
.fd_status
& FD_STATUS_C
) != FD_STATUS_C
)
2521 break; /* This is how we exit the loop. */
2525 /* Check whether frame was correctly received. */
2526 if((fd
.fd_status
& FD_STATUS_OK
) == FD_STATUS_OK
)
2528 /* Does the frame contain a pointer to the data? Let's check. */
2529 if(fd
.fd_rbd_offset
!= I82586NULL
)
2531 /* Read the receive buffer descriptor */
2532 obram_read(ioaddr
, fd
.fd_rbd_offset
,
2533 (unsigned char *) &rbd
, sizeof(rbd
));
2535 #ifdef DEBUG_RX_ERROR
2536 if((rbd
.rbd_status
& RBD_STATUS_EOF
) != RBD_STATUS_EOF
)
2537 printk(KERN_INFO
"%s: wv_receive(): missing EOF flag.\n",
2540 if((rbd
.rbd_status
& RBD_STATUS_F
) != RBD_STATUS_F
)
2541 printk(KERN_INFO
"%s: wv_receive(): missing F flag.\n",
2543 #endif /* DEBUG_RX_ERROR */
2545 /* Read the packet and transmit to Linux */
2546 wv_packet_read(dev
, rbd
.rbd_bufl
,
2547 rbd
.rbd_status
& RBD_STATUS_ACNT
);
2549 #ifdef DEBUG_RX_ERROR
2550 else /* if frame has no data */
2551 printk(KERN_INFO
"%s: wv_receive(): frame has no data.\n",
2555 else /* If reception was no successful */
2557 lp
->stats
.rx_errors
++;
2559 #ifdef DEBUG_RX_INFO
2560 printk(KERN_DEBUG
"%s: wv_receive(): frame not received successfully (%X).\n",
2561 dev
->name
, fd
.fd_status
);
2564 #ifdef DEBUG_RX_ERROR
2565 if((fd
.fd_status
& FD_STATUS_S6
) != 0)
2566 printk(KERN_INFO
"%s: wv_receive(): no EOF flag.\n", dev
->name
);
2569 if((fd
.fd_status
& FD_STATUS_S7
) != 0)
2571 lp
->stats
.rx_length_errors
++;
2572 #ifdef DEBUG_RX_FAIL
2573 printk(KERN_DEBUG
"%s: wv_receive(): frame too short.\n",
2578 if((fd
.fd_status
& FD_STATUS_S8
) != 0)
2580 lp
->stats
.rx_over_errors
++;
2581 #ifdef DEBUG_RX_FAIL
2582 printk(KERN_DEBUG
"%s: wv_receive(): rx DMA overrun.\n",
2587 if((fd
.fd_status
& FD_STATUS_S9
) != 0)
2589 lp
->stats
.rx_fifo_errors
++;
2590 #ifdef DEBUG_RX_FAIL
2591 printk(KERN_DEBUG
"%s: wv_receive(): ran out of resources.\n",
2596 if((fd
.fd_status
& FD_STATUS_S10
) != 0)
2598 lp
->stats
.rx_frame_errors
++;
2599 #ifdef DEBUG_RX_FAIL
2600 printk(KERN_DEBUG
"%s: wv_receive(): alignment error.\n",
2605 if((fd
.fd_status
& FD_STATUS_S11
) != 0)
2607 lp
->stats
.rx_crc_errors
++;
2608 #ifdef DEBUG_RX_FAIL
2609 printk(KERN_DEBUG
"%s: wv_receive(): CRC error.\n", dev
->name
);
2615 obram_write(ioaddr
, fdoff(lp
->rx_head
, fd_status
),
2616 (unsigned char *) &fd
.fd_status
, sizeof(fd
.fd_status
));
2618 fd
.fd_command
= FD_COMMAND_EL
;
2619 obram_write(ioaddr
, fdoff(lp
->rx_head
, fd_command
),
2620 (unsigned char *) &fd
.fd_command
, sizeof(fd
.fd_command
));
2623 obram_write(ioaddr
, fdoff(lp
->rx_last
, fd_command
),
2624 (unsigned char *) &fd
.fd_command
, sizeof(fd
.fd_command
));
2626 lp
->rx_last
= lp
->rx_head
;
2627 lp
->rx_head
= fd
.fd_link_offset
;
2628 } /* for(;;) -> loop on all frames */
2630 #ifdef DEBUG_RX_INFO
2632 printk(KERN_DEBUG
"%s: wv_receive(): reaped %d\n", dev
->name
, nreaped
);
2634 #ifdef DEBUG_RX_TRACE
2635 printk(KERN_DEBUG
"%s: <-wv_receive()\n", dev
->name
);
2639 /*********************** PACKET TRANSMISSION ***********************/
2641 * This part deals with sending packets through the WaveLAN.
2645 /*------------------------------------------------------------------*/
2647 * This routine fills in the appropriate registers and memory
2648 * locations on the WaveLAN card and starts the card off on
2652 * Each block contains a transmit command, a NOP command,
2653 * a transmit block descriptor and a buffer.
2654 * The CU read the transmit block which point to the tbd,
2655 * read the tbd and the content of the buffer.
2656 * When it has finish with it, it goes to the next command
2657 * which in our case is the NOP. The NOP points on itself,
2658 * so the CU stop here.
2659 * When we add the next block, we modify the previous nop
2660 * to make it point on the new tx command.
2661 * Simple, isn't it ?
2663 * (called in wavelan_packet_xmit())
2666 wv_packet_write(device
* dev
,
2670 net_local
* lp
= (net_local
*) dev
->priv
;
2671 u_long ioaddr
= dev
->base_addr
;
2672 unsigned short txblock
;
2673 unsigned short txpred
;
2674 unsigned short tx_addr
;
2675 unsigned short nop_addr
;
2676 unsigned short tbd_addr
;
2677 unsigned short buf_addr
;
2684 #ifdef DEBUG_TX_TRACE
2685 printk(KERN_DEBUG
"%s: ->wv_packet_write(%d)\n", dev
->name
, length
);
2688 /* Do we need some padding? */
2694 /* Calculate addresses of next block and previous block. */
2695 txblock
= lp
->tx_first_free
;
2696 txpred
= txblock
- TXBLOCKZ
;
2697 if(txpred
< OFFSET_CU
)
2698 txpred
+= NTXBLOCKS
* TXBLOCKZ
;
2699 lp
->tx_first_free
+= TXBLOCKZ
;
2700 if(lp
->tx_first_free
>= OFFSET_CU
+ NTXBLOCKS
* TXBLOCKZ
)
2701 lp
->tx_first_free
-= NTXBLOCKS
* TXBLOCKZ
;
2704 if (lp->tx_n_in_use > 0)
2705 printk("%c", "0123456789abcdefghijk"[lp->tx_n_in_use]);
2710 /* Calculate addresses of the different parts of the block. */
2712 nop_addr
= tx_addr
+ sizeof(tx
);
2713 tbd_addr
= nop_addr
+ sizeof(nop
);
2714 buf_addr
= tbd_addr
+ sizeof(tbd
);
2719 tx
.tx_h
.ac_status
= 0;
2720 obram_write(ioaddr
, toff(ac_tx_t
, tx_addr
, tx_h
.ac_status
),
2721 (unsigned char *) &tx
.tx_h
.ac_status
,
2722 sizeof(tx
.tx_h
.ac_status
));
2727 nop
.nop_h
.ac_status
= 0;
2728 obram_write(ioaddr
, toff(ac_nop_t
, nop_addr
, nop_h
.ac_status
),
2729 (unsigned char *) &nop
.nop_h
.ac_status
,
2730 sizeof(nop
.nop_h
.ac_status
));
2731 nop
.nop_h
.ac_link
= nop_addr
;
2732 obram_write(ioaddr
, toff(ac_nop_t
, nop_addr
, nop_h
.ac_link
),
2733 (unsigned char *) &nop
.nop_h
.ac_link
,
2734 sizeof(nop
.nop_h
.ac_link
));
2737 * Transmit buffer descriptor
2739 tbd
.tbd_status
= TBD_STATUS_EOF
| (TBD_STATUS_ACNT
& clen
);
2740 tbd
.tbd_next_bd_offset
= I82586NULL
;
2741 tbd
.tbd_bufl
= buf_addr
;
2743 obram_write(ioaddr
, tbd_addr
, (unsigned char *)&tbd
, sizeof(tbd
));
2748 obram_write(ioaddr
, buf_addr
, buf
, length
);
2751 * Overwrite the predecessor NOP link
2752 * so that it points to this txblock.
2754 nop_addr
= txpred
+ sizeof(tx
);
2755 nop
.nop_h
.ac_status
= 0;
2756 obram_write(ioaddr
, toff(ac_nop_t
, nop_addr
, nop_h
.ac_status
),
2757 (unsigned char *)&nop
.nop_h
.ac_status
,
2758 sizeof(nop
.nop_h
.ac_status
));
2759 nop
.nop_h
.ac_link
= txblock
;
2760 obram_write(ioaddr
, toff(ac_nop_t
, nop_addr
, nop_h
.ac_link
),
2761 (unsigned char *) &nop
.nop_h
.ac_link
,
2762 sizeof(nop
.nop_h
.ac_link
));
2764 /* Keep stats up to date. */
2765 lp
->stats
.tx_bytes
+= length
;
2767 /* If watchdog not already active, activate it... */
2768 if(lp
->watchdog
.prev
== (timer_list
*) NULL
)
2770 /* Set timer to expire in WATCHDOG_JIFFIES. */
2771 lp
->watchdog
.expires
= jiffies
+ WATCHDOG_JIFFIES
;
2772 add_timer(&lp
->watchdog
);
2775 if(lp
->tx_first_in_use
== I82586NULL
)
2776 lp
->tx_first_in_use
= txblock
;
2778 if(lp
->tx_n_in_use
< NTXBLOCKS
- 1)
2783 #ifdef DEBUG_TX_INFO
2784 wv_packet_info((u_char
*) buf
, length
, dev
->name
, "wv_packet_write");
2785 #endif /* DEBUG_TX_INFO */
2787 #ifdef DEBUG_TX_TRACE
2788 printk(KERN_DEBUG
"%s: <-wv_packet_write()\n", dev
->name
);
2792 /*------------------------------------------------------------------*/
2794 * This routine is called when we want to send a packet (NET3 callback)
2795 * In this routine, we check if the harware is ready to accept
2796 * the packet. We also prevent reentrance. Then we call the function
2797 * to send the packet.
2800 wavelan_packet_xmit(struct sk_buff
* skb
,
2803 net_local
* lp
= (net_local
*)dev
->priv
;
2805 #ifdef DEBUG_TX_TRACE
2806 printk(KERN_DEBUG
"%s: ->wavelan_packet_xmit(0x%X)\n", dev
->name
,
2810 /* This flag indicate that the hardware can't perform a transmission.
2811 * Theoretically, NET3 checks it before sending a packet to the driver,
2812 * but in fact it never does that and pools continuously.
2813 * As the watchdog will abort overly long transmissions, we are quite safe.
2819 * Block a timer-based transmit from overlapping.
2820 * In other words, prevent reentering this routine.
2822 if(test_and_set_bit(0, (void *)&dev
->tbusy
) != 0)
2823 #ifdef DEBUG_TX_ERROR
2824 printk(KERN_INFO
"%s: Transmitter access conflict.\n", dev
->name
);
2828 /* If somebody has asked to reconfigure the controller,
2831 if(lp
->reconfig_82586
)
2833 wv_82586_config(dev
);
2838 #ifdef DEBUG_TX_ERROR
2840 printk(KERN_INFO
"skb has next\n");
2843 wv_packet_write(dev
, skb
->data
, skb
->len
);
2848 #ifdef DEBUG_TX_TRACE
2849 printk(KERN_DEBUG
"%s: <-wavelan_packet_xmit()\n", dev
->name
);
2854 /*********************** HARDWARE CONFIGURATION ***********************/
2856 * This part does the real job of starting and configuring the hardware.
2859 /*--------------------------------------------------------------------*/
2861 * Routine to initialize the Modem Management Controller.
2862 * (called by wv_hw_reset())
2865 wv_mmc_init(device
* dev
)
2867 u_long ioaddr
= dev
->base_addr
;
2868 net_local
* lp
= (net_local
*)dev
->priv
;
2873 #ifdef DEBUG_CONFIG_TRACE
2874 printk(KERN_DEBUG
"%s: ->wv_mmc_init()\n", dev
->name
);
2877 /* Read the parameter storage area. */
2878 psa_read(ioaddr
, lp
->hacr
, 0, (unsigned char *) &psa
, sizeof(psa
));
2880 #ifdef USE_PSA_CONFIG
2881 configured
= psa
.psa_conf_status
& 1;
2886 /* Is the PSA is not configured */
2889 /* User will be able to configure NWID later (with iwconfig). */
2890 psa
.psa_nwid
[0] = 0;
2891 psa
.psa_nwid
[1] = 0;
2893 /* no NWID checking since NWID is not set */
2894 psa
.psa_nwid_select
= 0;
2896 /* Disable encryption */
2897 psa
.psa_encryption_select
= 0;
2899 /* Set to standard values:
2902 * 0x04 for PCMCIA and 2.00 card (AT&T 407-024689/E document)
2904 if (psa
.psa_comp_number
& 1)
2905 psa
.psa_thr_pre_set
= 0x01;
2907 psa
.psa_thr_pre_set
= 0x04;
2908 psa
.psa_quality_thr
= 0x03;
2910 /* It is configured */
2911 psa
.psa_conf_status
|= 1;
2913 #ifdef USE_PSA_CONFIG
2914 /* Write the psa. */
2915 psa_write(ioaddr
, lp
->hacr
, (char *)psa
.psa_nwid
- (char *)&psa
,
2916 (unsigned char *)psa
.psa_nwid
, 4);
2917 psa_write(ioaddr
, lp
->hacr
, (char *)&psa
.psa_thr_pre_set
- (char *)&psa
,
2918 (unsigned char *)&psa
.psa_thr_pre_set
, 1);
2919 psa_write(ioaddr
, lp
->hacr
, (char *)&psa
.psa_quality_thr
- (char *)&psa
,
2920 (unsigned char *)&psa
.psa_quality_thr
, 1);
2921 psa_write(ioaddr
, lp
->hacr
, (char *)&psa
.psa_conf_status
- (char *)&psa
,
2922 (unsigned char *)&psa
.psa_conf_status
, 1);
2923 /* update the Wavelan checksum */
2924 update_psa_checksum(dev
, ioaddr
, lp
->hacr
);
2928 /* Zero the mmc structure. */
2929 memset(&m
, 0x00, sizeof(m
));
2931 /* Copy PSA info to the mmc. */
2932 m
.mmw_netw_id_l
= psa
.psa_nwid
[1];
2933 m
.mmw_netw_id_h
= psa
.psa_nwid
[0];
2935 if(psa
.psa_nwid_select
& 1)
2936 m
.mmw_loopt_sel
= 0x00;
2938 m
.mmw_loopt_sel
= MMW_LOOPT_SEL_DIS_NWID
;
2940 memcpy(&m
.mmw_encr_key
, &psa
.psa_encryption_key
,
2941 sizeof(m
.mmw_encr_key
));
2943 if(psa
.psa_encryption_select
)
2944 m
.mmw_encr_enable
= MMW_ENCR_ENABLE_EN
| MMW_ENCR_ENABLE_MODE
;
2946 m
.mmw_encr_enable
= 0;
2948 m
.mmw_thr_pre_set
= psa
.psa_thr_pre_set
& 0x3F;
2949 m
.mmw_quality_thr
= psa
.psa_quality_thr
& 0x0F;
2952 * Set default modem control parameters.
2953 * See NCR document 407-0024326 Rev. A.
2955 m
.mmw_jabber_enable
= 0x01;
2957 m
.mmw_anten_sel
= MMW_ANTEN_SEL_ALG_EN
;
2959 m
.mmw_mod_delay
= 0x04;
2960 m
.mmw_jam_time
= 0x38;
2962 m
.mmw_des_io_invert
= 0;
2963 m
.mmw_decay_prm
= 0;
2964 m
.mmw_decay_updat_prm
= 0;
2966 /* Write all info to MMC. */
2967 mmc_write(ioaddr
, 0, (u_char
*)&m
, sizeof(m
));
2969 /* The following code starts the modem of the 2.00 frequency
2970 * selectable cards at power on. It's not strictly needed for the
2972 * The original patch was by Joe Finney for the PCMCIA driver, but
2973 * I've cleaned it up a bit and added documentation.
2974 * Thanks to Loeke Brederveld from Lucent for the info.
2977 /* Attempt to recognise 2.00 cards (2.4 GHz frequency selectable)
2978 * Does it work for everybody, especially old cards? */
2979 /* Note: WFREQSEL verifies that it is able to read a sensible
2980 * frequency from EEPROM (address 0x00) and that MMR_FEE_STATUS_ID
2981 * is 0xA (Xilinx version) or 0xB (Ariadne version).
2982 * My test is more crude but does work. */
2983 if(!(mmc_in(ioaddr
, mmroff(0, mmr_fee_status
)) &
2984 (MMR_FEE_STATUS_DWLD
| MMR_FEE_STATUS_BUSY
)))
2986 /* We must download the frequency parameters to the
2987 * synthesizers (from the EEPROM - area 1)
2988 * Note: as the EEPROM is automatically decremented, we set the end
2990 m
.mmw_fee_addr
= 0x0F;
2991 m
.mmw_fee_ctrl
= MMW_FEE_CTRL_READ
| MMW_FEE_CTRL_DWLD
;
2992 mmc_write(ioaddr
, (char *)&m
.mmw_fee_ctrl
- (char *)&m
,
2993 (unsigned char *)&m
.mmw_fee_ctrl
, 2);
2995 /* Wait until the download is finished. */
2996 fee_wait(ioaddr
, 100, 100);
2998 #ifdef DEBUG_CONFIG_INFO
2999 /* The frequency was in the last word downloaded. */
3000 mmc_read(ioaddr
, (char *)&m
.mmw_fee_data_l
- (char *)&m
,
3001 (unsigned char *)&m
.mmw_fee_data_l
, 2);
3003 /* Print some info for the user. */
3004 printk(KERN_DEBUG
"%s: WaveLAN 2.00 recognised (frequency select). Current frequency = %ld\n",
3006 ((m
.mmw_fee_data_h
<< 4) |
3007 (m
.mmw_fee_data_l
>> 4)) * 5 / 2 + 24000L);
3010 /* We must now download the power adjust value (gain) to
3011 * the synthesizers (from the EEPROM - area 7 - DAC). */
3012 m
.mmw_fee_addr
= 0x61;
3013 m
.mmw_fee_ctrl
= MMW_FEE_CTRL_READ
| MMW_FEE_CTRL_DWLD
;
3014 mmc_write(ioaddr
, (char *)&m
.mmw_fee_ctrl
- (char *)&m
,
3015 (unsigned char *)&m
.mmw_fee_ctrl
, 2);
3017 /* Wait until the download is finished. */
3018 } /* if 2.00 card */
3020 #ifdef DEBUG_CONFIG_TRACE
3021 printk(KERN_DEBUG
"%s: <-wv_mmc_init()\n", dev
->name
);
3026 /*------------------------------------------------------------------*/
3028 * Construct the fd and rbd structures.
3029 * Start the receive unit.
3030 * (called by wv_hw_reset())
3033 wv_ru_start(device
* dev
)
3035 net_local
* lp
= (net_local
*) dev
->priv
;
3036 u_long ioaddr
= dev
->base_addr
;
3044 #ifdef DEBUG_CONFIG_TRACE
3045 printk(KERN_DEBUG
"%s: ->wv_ru_start()\n", dev
->name
);
3048 obram_read(ioaddr
, scboff(OFFSET_SCB
, scb_status
), (unsigned char *)&scb_cs
, sizeof(scb_cs
));
3049 if((scb_cs
& SCB_ST_RUS
) == SCB_ST_RUS_RDY
)
3052 lp
->rx_head
= OFFSET_RU
;
3054 for(i
= 0, rx
= lp
->rx_head
; i
< NRXBLOCKS
; i
++, rx
= rx_next
)
3056 rx_next
= (i
== NRXBLOCKS
- 1) ? lp
->rx_head
: rx
+ RXBLOCKZ
;
3059 fd
.fd_command
= (i
== NRXBLOCKS
- 1) ? FD_COMMAND_EL
: 0;
3060 fd
.fd_link_offset
= rx_next
;
3061 fd
.fd_rbd_offset
= rx
+ sizeof(fd
);
3062 obram_write(ioaddr
, rx
, (unsigned char *)&fd
, sizeof(fd
));
3065 rbd
.rbd_next_rbd_offset
= I82586NULL
;
3066 rbd
.rbd_bufl
= rx
+ sizeof(fd
) + sizeof(rbd
);
3068 rbd
.rbd_el_size
= RBD_EL
| (RBD_SIZE
& MAXDATAZ
);
3069 obram_write(ioaddr
, rx
+ sizeof(fd
),
3070 (unsigned char *) &rbd
, sizeof(rbd
));
3075 obram_write(ioaddr
, scboff(OFFSET_SCB
, scb_rfa_offset
),
3076 (unsigned char *) &lp
->rx_head
, sizeof(lp
->rx_head
));
3078 scb_cs
= SCB_CMD_RUC_GO
;
3079 obram_write(ioaddr
, scboff(OFFSET_SCB
, scb_command
),
3080 (unsigned char *) &scb_cs
, sizeof(scb_cs
));
3082 set_chan_attn(ioaddr
, lp
->hacr
);
3084 for(i
= 1000; i
> 0; i
--)
3086 obram_read(ioaddr
, scboff(OFFSET_SCB
, scb_command
),
3087 (unsigned char *) &scb_cs
, sizeof(scb_cs
));
3096 #ifdef DEBUG_CONFIG_ERROR
3097 printk(KERN_INFO
"%s: wavelan_ru_start(): board not accepting command.\n",
3103 #ifdef DEBUG_CONFIG_TRACE
3104 printk(KERN_DEBUG
"%s: <-wv_ru_start()\n", dev
->name
);
3109 /*------------------------------------------------------------------*/
3111 * Initialise the transmit blocks.
3112 * Start the command unit executing the NOP
3113 * self-loop of the first transmit block.
3115 * Here we create the list of send buffers used to transmit packets
3116 * between the PC and the command unit. For each buffer, we create a
3117 * buffer descriptor (pointing on the buffer), a transmit command
3118 * (pointing to the buffer descriptor) and a NOP command.
3119 * The transmit command is linked to the NOP, and the NOP to itself.
3120 * When we will have finished executing the transmit command, we will
3121 * then loop on the NOP. By releasing the NOP link to a new command,
3122 * we may send another buffer.
3124 * (called by wv_hw_reset())
3127 wv_cu_start(device
* dev
)
3129 net_local
* lp
= (net_local
*) dev
->priv
;
3130 u_long ioaddr
= dev
->base_addr
;
3136 #ifdef DEBUG_CONFIG_TRACE
3137 printk(KERN_DEBUG
"%s: ->wv_cu_start()\n", dev
->name
);
3140 lp
->tx_first_free
= OFFSET_CU
;
3141 lp
->tx_first_in_use
= I82586NULL
;
3143 for(i
= 0, txblock
= OFFSET_CU
;
3145 i
++, txblock
+= TXBLOCKZ
)
3150 unsigned short tx_addr
;
3151 unsigned short nop_addr
;
3152 unsigned short tbd_addr
;
3153 unsigned short buf_addr
;
3156 nop_addr
= tx_addr
+ sizeof(tx
);
3157 tbd_addr
= nop_addr
+ sizeof(nop
);
3158 buf_addr
= tbd_addr
+ sizeof(tbd
);
3160 tx
.tx_h
.ac_status
= 0;
3161 tx
.tx_h
.ac_command
= acmd_transmit
| AC_CFLD_I
;
3162 tx
.tx_h
.ac_link
= nop_addr
;
3163 tx
.tx_tbd_offset
= tbd_addr
;
3164 obram_write(ioaddr
, tx_addr
, (unsigned char *) &tx
, sizeof(tx
));
3166 nop
.nop_h
.ac_status
= 0;
3167 nop
.nop_h
.ac_command
= acmd_nop
;
3168 nop
.nop_h
.ac_link
= nop_addr
;
3169 obram_write(ioaddr
, nop_addr
, (unsigned char *) &nop
, sizeof(nop
));
3171 tbd
.tbd_status
= TBD_STATUS_EOF
;
3172 tbd
.tbd_next_bd_offset
= I82586NULL
;
3173 tbd
.tbd_bufl
= buf_addr
;
3175 obram_write(ioaddr
, tbd_addr
, (unsigned char *) &tbd
, sizeof(tbd
));
3178 first_nop
= OFFSET_CU
+ (NTXBLOCKS
- 1) * TXBLOCKZ
+ sizeof(ac_tx_t
);
3179 obram_write(ioaddr
, scboff(OFFSET_SCB
, scb_cbl_offset
),
3180 (unsigned char *) &first_nop
, sizeof(first_nop
));
3182 scb_cs
= SCB_CMD_CUC_GO
;
3183 obram_write(ioaddr
, scboff(OFFSET_SCB
, scb_command
),
3184 (unsigned char *) &scb_cs
, sizeof(scb_cs
));
3186 set_chan_attn(ioaddr
, lp
->hacr
);
3188 for(i
= 1000; i
> 0; i
--)
3190 obram_read(ioaddr
, scboff(OFFSET_SCB
, scb_command
),
3191 (unsigned char *) &scb_cs
, sizeof(scb_cs
));
3200 #ifdef DEBUG_CONFIG_ERROR
3201 printk(KERN_INFO
"%s: wavelan_cu_start(): board not accepting command.\n",
3207 lp
->tx_n_in_use
= 0;
3210 #ifdef DEBUG_CONFIG_TRACE
3211 printk(KERN_DEBUG
"%s: <-wv_cu_start()\n", dev
->name
);
3216 /*------------------------------------------------------------------*/
3218 * This routine does a standard configuration of the WaveLAN
3219 * controller (i82586).
3221 * It initialises the scp, iscp and scb structure
3222 * The first two are just pointers to the next.
3223 * The last one is used for basic configuration and for basic
3224 * communication (interrupt status).
3226 * (called by wv_hw_reset())
3229 wv_82586_start(device
* dev
)
3231 net_local
* lp
= (net_local
*) dev
->priv
;
3232 u_long ioaddr
= dev
->base_addr
;
3233 scp_t scp
; /* system configuration pointer */
3234 iscp_t iscp
; /* intermediate scp */
3235 scb_t scb
; /* system control block */
3236 ach_t cb
; /* Action command header */
3240 #ifdef DEBUG_CONFIG_TRACE
3241 printk(KERN_DEBUG
"%s: ->wv_82586_start()\n", dev
->name
);
3245 * Clear the onboard RAM.
3247 memset(&zeroes
[0], 0x00, sizeof(zeroes
));
3248 for(i
= 0; i
< I82586_MEMZ
; i
+= sizeof(zeroes
))
3249 obram_write(ioaddr
, i
, &zeroes
[0], sizeof(zeroes
));
3252 * Construct the command unit structures:
3253 * scp, iscp, scb, cb.
3255 memset(&scp
, 0x00, sizeof(scp
));
3256 scp
.scp_sysbus
= SCP_SY_16BBUS
;
3257 scp
.scp_iscpl
= OFFSET_ISCP
;
3258 obram_write(ioaddr
, OFFSET_SCP
, (unsigned char *)&scp
, sizeof(scp
));
3260 memset(&iscp
, 0x00, sizeof(iscp
));
3262 iscp
.iscp_offset
= OFFSET_SCB
;
3263 obram_write(ioaddr
, OFFSET_ISCP
, (unsigned char *)&iscp
, sizeof(iscp
));
3265 /* Our first command is to reset the i82586. */
3266 memset(&scb
, 0x00, sizeof(scb
));
3267 scb
.scb_command
= SCB_CMD_RESET
;
3268 scb
.scb_cbl_offset
= OFFSET_CU
;
3269 scb
.scb_rfa_offset
= OFFSET_RU
;
3270 obram_write(ioaddr
, OFFSET_SCB
, (unsigned char *)&scb
, sizeof(scb
));
3272 set_chan_attn(ioaddr
, lp
->hacr
);
3274 /* Wait for command to finish. */
3275 for(i
= 1000; i
> 0; i
--)
3277 obram_read(ioaddr
, OFFSET_ISCP
, (unsigned char *) &iscp
, sizeof(iscp
));
3279 if(iscp
.iscp_busy
== (unsigned short) 0)
3287 #ifdef DEBUG_CONFIG_ERROR
3288 printk(KERN_INFO
"%s: wv_82586_start(): iscp_busy timeout.\n",
3294 /* Check command completion. */
3295 for(i
= 15; i
> 0; i
--)
3297 obram_read(ioaddr
, OFFSET_SCB
, (unsigned char *) &scb
, sizeof(scb
));
3299 if (scb
.scb_status
== (SCB_ST_CX
| SCB_ST_CNA
))
3307 #ifdef DEBUG_CONFIG_ERROR
3308 printk(KERN_INFO
"%s: wv_82586_start(): status: expected 0x%02x, got 0x%02x.\n",
3309 dev
->name
, SCB_ST_CX
| SCB_ST_CNA
, scb
.scb_status
);
3316 /* Set the action command header. */
3317 memset(&cb
, 0x00, sizeof(cb
));
3318 cb
.ac_command
= AC_CFLD_EL
| (AC_CFLD_CMD
& acmd_diagnose
);
3319 cb
.ac_link
= OFFSET_CU
;
3320 obram_write(ioaddr
, OFFSET_CU
, (unsigned char *)&cb
, sizeof(cb
));
3322 if(wv_synchronous_cmd(dev
, "diag()") == -1)
3325 obram_read(ioaddr
, OFFSET_CU
, (unsigned char *)&cb
, sizeof(cb
));
3326 if(cb
.ac_status
& AC_SFLD_FAIL
)
3328 #ifdef DEBUG_CONFIG_ERROR
3329 printk(KERN_INFO
"%s: wv_82586_start(): i82586 Self Test failed.\n",
3335 #ifdef DEBUG_I82586_SHOW
3336 wv_scb_show(ioaddr
);
3339 #ifdef DEBUG_CONFIG_TRACE
3340 printk(KERN_DEBUG
"%s: <-wv_82586_start()\n", dev
->name
);
3345 /*------------------------------------------------------------------*/
3347 * This routine does a standard configuration of the WaveLAN
3348 * controller (i82586).
3350 * This routine is a violent hack. We use the first free transmit block
3351 * to make our configuration. In the buffer area, we create the three
3352 * configuration commands (linked). We make the previous NOP point to
3353 * the beginning of the buffer instead of the tx command. After, we go
3354 * as usual to the NOP command.
3355 * Note that only the last command (mc_set) will generate an interrupt.
3357 * (called by wv_hw_reset(), wv_82586_reconfig())
3360 wv_82586_config(device
* dev
)
3362 net_local
* lp
= (net_local
*) dev
->priv
;
3363 u_long ioaddr
= dev
->base_addr
;
3364 unsigned short txblock
;
3365 unsigned short txpred
;
3366 unsigned short tx_addr
;
3367 unsigned short nop_addr
;
3368 unsigned short tbd_addr
;
3369 unsigned short cfg_addr
;
3370 unsigned short ias_addr
;
3371 unsigned short mcs_addr
;
3374 ac_cfg_t cfg
; /* Configure action */
3375 ac_ias_t ias
; /* IA-setup action */
3376 ac_mcs_t mcs
; /* Multicast setup */
3377 struct dev_mc_list
* dmi
;
3380 #ifdef DEBUG_CONFIG_TRACE
3381 printk(KERN_DEBUG
"%s: ->wv_82586_config()\n", dev
->name
);
3386 /* Calculate addresses of next block and previous block. */
3387 txblock
= lp
->tx_first_free
;
3388 txpred
= txblock
- TXBLOCKZ
;
3389 if(txpred
< OFFSET_CU
)
3390 txpred
+= NTXBLOCKS
* TXBLOCKZ
;
3391 lp
->tx_first_free
+= TXBLOCKZ
;
3392 if(lp
->tx_first_free
>= OFFSET_CU
+ NTXBLOCKS
* TXBLOCKZ
)
3393 lp
->tx_first_free
-= NTXBLOCKS
* TXBLOCKZ
;
3397 /* Calculate addresses of the different parts of the block. */
3399 nop_addr
= tx_addr
+ sizeof(tx
);
3400 tbd_addr
= nop_addr
+ sizeof(nop
);
3401 cfg_addr
= tbd_addr
+ sizeof(tbd_t
); /* beginning of the buffer */
3402 ias_addr
= cfg_addr
+ sizeof(cfg
);
3403 mcs_addr
= ias_addr
+ sizeof(ias
);
3408 tx
.tx_h
.ac_status
= 0xFFFF; /* Fake completion value */
3409 obram_write(ioaddr
, toff(ac_tx_t
, tx_addr
, tx_h
.ac_status
),
3410 (unsigned char *) &tx
.tx_h
.ac_status
,
3411 sizeof(tx
.tx_h
.ac_status
));
3416 nop
.nop_h
.ac_status
= 0;
3417 obram_write(ioaddr
, toff(ac_nop_t
, nop_addr
, nop_h
.ac_status
),
3418 (unsigned char *) &nop
.nop_h
.ac_status
,
3419 sizeof(nop
.nop_h
.ac_status
));
3420 nop
.nop_h
.ac_link
= nop_addr
;
3421 obram_write(ioaddr
, toff(ac_nop_t
, nop_addr
, nop_h
.ac_link
),
3422 (unsigned char *) &nop
.nop_h
.ac_link
,
3423 sizeof(nop
.nop_h
.ac_link
));
3425 /* Create a configure action. */
3426 memset(&cfg
, 0x00, sizeof(cfg
));
3429 * For Linux we invert AC_CFG_ALOC() so as to conform
3430 * to the way that net packets reach us from above.
3431 * (See also ac_tx_t.)
3433 * Updated from Wavelan Manual WCIN085B
3435 cfg
.cfg_byte_cnt
= AC_CFG_BYTE_CNT(sizeof(ac_cfg_t
) - sizeof(ach_t
));
3436 cfg
.cfg_fifolim
= AC_CFG_FIFOLIM(4);
3437 cfg
.cfg_byte8
= AC_CFG_SAV_BF(1) |
3439 cfg
.cfg_byte9
= AC_CFG_ELPBCK(0) |
3441 AC_CFG_PRELEN(AC_CFG_PLEN_2
) |
3443 AC_CFG_ADDRLEN(WAVELAN_ADDR_SIZE
);
3444 cfg
.cfg_byte10
= AC_CFG_BOFMET(1) |
3448 cfg
.cfg_slotl
= 0x0C;
3449 cfg
.cfg_byte13
= AC_CFG_RETRYNUM(15) |
3451 cfg
.cfg_byte14
= AC_CFG_FLGPAD(0) |
3458 AC_CFG_PRM(lp
->promiscuous
);
3459 cfg
.cfg_byte15
= AC_CFG_ICDS(0) |
3464 cfg.cfg_min_frm_len = AC_CFG_MNFRM(64);
3466 cfg
.cfg_min_frm_len
= AC_CFG_MNFRM(8);
3468 cfg
.cfg_h
.ac_command
= (AC_CFLD_CMD
& acmd_configure
);
3469 cfg
.cfg_h
.ac_link
= ias_addr
;
3470 obram_write(ioaddr
, cfg_addr
, (unsigned char *)&cfg
, sizeof(cfg
));
3472 /* Set up the MAC address */
3473 memset(&ias
, 0x00, sizeof(ias
));
3474 ias
.ias_h
.ac_command
= (AC_CFLD_CMD
& acmd_ia_setup
);
3475 ias
.ias_h
.ac_link
= mcs_addr
;
3476 memcpy(&ias
.ias_addr
[0], (unsigned char *)&dev
->dev_addr
[0], sizeof(ias
.ias_addr
));
3477 obram_write(ioaddr
, ias_addr
, (unsigned char *)&ias
, sizeof(ias
));
3479 /* Initialize adapter's Ethernet multicast addresses */
3480 memset(&mcs
, 0x00, sizeof(mcs
));
3481 mcs
.mcs_h
.ac_command
= AC_CFLD_I
| (AC_CFLD_CMD
& acmd_mc_setup
);
3482 mcs
.mcs_h
.ac_link
= nop_addr
;
3483 mcs
.mcs_cnt
= WAVELAN_ADDR_SIZE
* lp
->mc_count
;
3484 obram_write(ioaddr
, mcs_addr
, (unsigned char *)&mcs
, sizeof(mcs
));
3486 /* Any address to set? */
3489 for(dmi
=dev
->mc_list
; dmi
; dmi
=dmi
->next
)
3490 outsw(PIOP1(ioaddr
), (u_short
*) dmi
->dmi_addr
,
3491 WAVELAN_ADDR_SIZE
>> 1);
3493 #ifdef DEBUG_CONFIG_INFO
3494 printk(KERN_DEBUG
"%s: wv_82586_config(): set %d multicast addresses:\n",
3495 dev
->name
, lp
->mc_count
);
3496 for(dmi
=dev
->mc_list
; dmi
; dmi
=dmi
->next
)
3497 printk(KERN_DEBUG
" %02x:%02x:%02x:%02x:%02x:%02x\n",
3498 dmi
->dmi_addr
[0], dmi
->dmi_addr
[1], dmi
->dmi_addr
[2],
3499 dmi
->dmi_addr
[3], dmi
->dmi_addr
[4], dmi
->dmi_addr
[5] );
3504 * Overwrite the predecessor NOP link
3505 * so that it points to the configure action.
3507 nop_addr
= txpred
+ sizeof(tx
);
3508 nop
.nop_h
.ac_status
= 0;
3509 obram_write(ioaddr
, toff(ac_nop_t
, nop_addr
, nop_h
.ac_status
),
3510 (unsigned char *)&nop
.nop_h
.ac_status
,
3511 sizeof(nop
.nop_h
.ac_status
));
3512 nop
.nop_h
.ac_link
= cfg_addr
;
3513 obram_write(ioaddr
, toff(ac_nop_t
, nop_addr
, nop_h
.ac_link
),
3514 (unsigned char *) &nop
.nop_h
.ac_link
,
3515 sizeof(nop
.nop_h
.ac_link
));
3517 /* If watchdog not already active, activate it... */
3518 if(lp
->watchdog
.prev
== (timer_list
*) NULL
)
3520 /* set timer to expire in WATCHDOG_JIFFIES */
3521 lp
->watchdog
.expires
= jiffies
+ WATCHDOG_JIFFIES
;
3522 add_timer(&lp
->watchdog
);
3525 lp
->reconfig_82586
= 0;
3527 if(lp
->tx_first_in_use
== I82586NULL
)
3528 lp
->tx_first_in_use
= txblock
;
3530 if(lp
->tx_n_in_use
< NTXBLOCKS
- 1)
3535 #ifdef DEBUG_CONFIG_TRACE
3536 printk(KERN_DEBUG
"%s: <-wv_82586_config()\n", dev
->name
);
3540 /*------------------------------------------------------------------*/
3542 * This routine, called by wavelan_close(), gracefully stops the
3543 * WaveLAN controller (i82586).
3546 wv_82586_stop(device
* dev
)
3548 net_local
* lp
= (net_local
*) dev
->priv
;
3549 u_long ioaddr
= dev
->base_addr
;
3552 #ifdef DEBUG_CONFIG_TRACE
3553 printk(KERN_DEBUG
"%s: ->wv_82586_stop()\n", dev
->name
);
3556 /* Suspend both command unit and receive unit. */
3557 scb_cmd
= (SCB_CMD_CUC
& SCB_CMD_CUC_SUS
) | (SCB_CMD_RUC
& SCB_CMD_RUC_SUS
);
3558 obram_write(ioaddr
, scboff(OFFSET_SCB
, scb_command
),
3559 (unsigned char *)&scb_cmd
, sizeof(scb_cmd
));
3560 set_chan_attn(ioaddr
, lp
->hacr
);
3562 /* No more interrupts */
3565 #ifdef DEBUG_CONFIG_TRACE
3566 printk(KERN_DEBUG
"%s: <-wv_82586_stop()\n", dev
->name
);
3570 /*------------------------------------------------------------------*/
3572 * Totally reset the WaveLAN and restart it.
3573 * Performs the following actions:
3574 * 1. A power reset (reset DMA)
3575 * 2. Initialize the radio modem (using wv_mmc_init)
3576 * 3. Reset & Configure LAN controller (using wv_82586_start)
3577 * 4. Start the LAN controller's command unit
3578 * 5. Start the LAN controller's receive unit
3581 wv_hw_reset(device
* dev
)
3583 net_local
* lp
= (net_local
*)dev
->priv
;
3584 u_long ioaddr
= dev
->base_addr
;
3586 #ifdef DEBUG_CONFIG_TRACE
3587 printk(KERN_DEBUG
"%s: ->wv_hw_reset(dev=0x%x)\n", dev
->name
,
3591 /* If watchdog was activated, kill it! */
3592 if(lp
->watchdog
.prev
!= (timer_list
*) NULL
)
3593 del_timer(&lp
->watchdog
);
3595 /* Increase the number of resets done. */
3598 wv_hacr_reset(ioaddr
);
3599 lp
->hacr
= HACR_DEFAULT
;
3601 if((wv_mmc_init(dev
) < 0) ||
3602 (wv_82586_start(dev
) < 0))
3605 /* Enable the card to send interrupts. */
3608 /* Start card functions */
3609 if(wv_cu_start(dev
) < 0)
3612 /* Setup the controller and parameters */
3613 wv_82586_config(dev
);
3615 /* Finish configuration with the receive unit */
3616 if(wv_ru_start(dev
) < 0)
3619 #ifdef DEBUG_CONFIG_TRACE
3620 printk(KERN_DEBUG
"%s: <-wv_hw_reset()\n", dev
->name
);
3625 /*------------------------------------------------------------------*/
3627 * Check if there is a WaveLAN at the specific base address.
3628 * As a side effect, this reads the MAC address.
3629 * (called in wavelan_probe() and init_module())
3632 wv_check_ioaddr(u_long ioaddr
,
3635 int i
; /* Loop counter */
3637 /* Check if the base address if available. */
3638 if(check_region(ioaddr
, sizeof(ha_t
)))
3639 return EADDRINUSE
; /* ioaddr already used */
3641 /* Reset host interface */
3642 wv_hacr_reset(ioaddr
);
3644 /* Read the MAC address from the parameter storage area. */
3645 psa_read(ioaddr
, HACR_DEFAULT
, psaoff(0, psa_univ_mac_addr
),
3649 * Check the first three octets of the address for the manufacturer's code.
3650 * Note: if this can't find your WaveLAN card, you've got a
3651 * non-NCR/AT&T/Lucent ISA card. See wavelan.p.h for detail on
3652 * how to configure your card.
3654 for(i
= 0; i
< (sizeof(MAC_ADDRESSES
) / sizeof(char) / 3); i
++)
3655 if((mac
[0] == MAC_ADDRESSES
[i
][0]) &&
3656 (mac
[1] == MAC_ADDRESSES
[i
][1]) &&
3657 (mac
[2] == MAC_ADDRESSES
[i
][2]))
3660 #ifdef DEBUG_CONFIG_INFO
3661 printk(KERN_WARNING
"WaveLAN (0x%3X): your MAC address might be %02X:%02X:%02X.\n",
3662 ioaddr
, mac
[0], mac
[1], mac
[2]);
3667 /************************ INTERRUPT HANDLING ************************/
3670 * This function is the interrupt handler for the WaveLAN card. This
3671 * routine will be called whenever:
3674 wavelan_interrupt(int irq
,
3676 struct pt_regs
* regs
)
3687 #ifdef DEBUG_INTERRUPT_TRACE
3688 printk(KERN_DEBUG
"%s: ->wavelan_interrupt()\n", dev
->name
);
3691 lp
= (net_local
*) dev
->priv
;
3692 ioaddr
= dev
->base_addr
;
3694 /* Prevent reentrance. What should we do here? */
3695 #ifdef DEBUG_INTERRUPT_ERROR
3697 printk(KERN_INFO
"%s: wavelan_interrupt(): Re-entering the interrupt handler.\n",
3702 if((hasr
= hasr_read(ioaddr
)) & HASR_MMC_INTR
)
3707 * Interrupt from the modem management controller.
3708 * This will clear it -- ignored for now.
3710 mmc_read(ioaddr
, mmroff(0, mmr_dce_status
), &dce_status
, sizeof(dce_status
));
3711 #ifdef DEBUG_INTERRUPT_ERROR
3712 printk(KERN_INFO
"%s: wavelan_interrupt(): unexpected mmc interrupt: status 0x%04x.\n",
3713 dev
->name
, dce_status
);
3717 if((hasr
& HASR_82586_INTR
) == 0)
3720 #ifdef DEBUG_INTERRUPT_ERROR
3721 printk(KERN_INFO
"%s: wavelan_interrupt(): interrupt not coming from i82586\n",
3727 /* Read interrupt data. */
3728 obram_read(ioaddr
, scboff(OFFSET_SCB
, scb_status
),
3729 (unsigned char *) &status
, sizeof(status
));
3732 * Acknowledge the interrupt(s).
3734 ack_cmd
= status
& SCB_ST_INT
;
3735 obram_write(ioaddr
, scboff(OFFSET_SCB
, scb_command
),
3736 (unsigned char *) &ack_cmd
, sizeof(ack_cmd
));
3737 set_chan_attn(ioaddr
, lp
->hacr
);
3739 #ifdef DEBUG_INTERRUPT_INFO
3740 printk(KERN_DEBUG
"%s: wavelan_interrupt(): status 0x%04x.\n",
3744 /* Command completed. */
3745 if((status
& SCB_ST_CX
) == SCB_ST_CX
)
3747 #ifdef DEBUG_INTERRUPT_INFO
3748 printk(KERN_DEBUG
"%s: wavelan_interrupt(): command completed.\n",
3751 wv_complete(dev
, ioaddr
, lp
);
3753 /* If watchdog was activated, kill it ! */
3754 if(lp
->watchdog
.prev
!= (timer_list
*) NULL
)
3755 del_timer(&lp
->watchdog
);
3756 if(lp
->tx_n_in_use
> 0)
3758 /* set timer to expire in WATCHDOG_JIFFIES */
3759 lp
->watchdog
.expires
= jiffies
+ WATCHDOG_JIFFIES
;
3760 add_timer(&lp
->watchdog
);
3764 /* Frame received. */
3765 if((status
& SCB_ST_FR
) == SCB_ST_FR
)
3767 #ifdef DEBUG_INTERRUPT_INFO
3768 printk(KERN_DEBUG
"%s: wavelan_interrupt(): received packet.\n",
3774 /* Check the state of the command unit. */
3775 if(((status
& SCB_ST_CNA
) == SCB_ST_CNA
) ||
3776 (((status
& SCB_ST_CUS
) != SCB_ST_CUS_ACTV
) && dev
->start
))
3778 #ifdef DEBUG_INTERRUPT_ERROR
3779 printk(KERN_INFO
"%s: wavelan_interrupt(): CU inactive -- restarting\n",
3785 /* Check the state of the command unit. */
3786 if(((status
& SCB_ST_RNR
) == SCB_ST_RNR
) ||
3787 (((status
& SCB_ST_RUS
) != SCB_ST_RUS_RDY
) && dev
->start
))
3789 #ifdef DEBUG_INTERRUPT_ERROR
3790 printk(KERN_INFO
"%s: wavelan_interrupt(): RU not ready -- restarting\n",
3798 #ifdef DEBUG_INTERRUPT_TRACE
3799 printk(KERN_DEBUG
"%s: <-wavelan_interrupt()\n", dev
->name
);
3803 /*------------------------------------------------------------------*/
3805 * Watchdog: when we start a transmission, we set a timer in the
3806 * kernel. If the transmission completes, this timer is disabled. If
3807 * the timer expires, we try to unlock the hardware.
3809 * Note: this watchdog doesn't work on the same principle as the
3810 * watchdog in the previous version of the ISA driver. I made it this
3811 * way because the overhead of add_timer() and del_timer() is nothing
3812 * and because it avoids calling the watchdog, saving some CPU.
3815 wavelan_watchdog(u_long a
)
3821 unsigned int nreaped
;
3824 ioaddr
= dev
->base_addr
;
3825 lp
= (net_local
*) dev
->priv
;
3827 #ifdef DEBUG_INTERRUPT_TRACE
3828 printk(KERN_DEBUG
"%s: ->wavelan_watchdog()\n", dev
->name
);
3831 #ifdef DEBUG_INTERRUPT_ERROR
3832 printk(KERN_INFO
"%s: wavelan_watchdog: watchdog timer expired\n",
3839 ioaddr
= dev
->base_addr
;
3840 lp
= (net_local
*) dev
->priv
;
3842 if(lp
->tx_n_in_use
<= 0)
3848 nreaped
= wv_complete(dev
, ioaddr
, lp
);
3850 #ifdef DEBUG_INTERRUPT_INFO
3851 printk(KERN_DEBUG
"%s: wavelan_watchdog(): %d reaped, %d remain.\n",
3852 dev
->name
, nreaped
, lp
->tx_n_in_use
);
3855 #ifdef DEBUG_PSA_SHOW
3858 psa_read(dev
, 0, (unsigned char *) &psa
, sizeof(psa
));
3862 #ifdef DEBUG_MMC_SHOW
3865 #ifdef DEBUG_I82586_SHOW
3869 /* If no buffer has been freed */
3872 #ifdef DEBUG_INTERRUPT_ERROR
3873 printk(KERN_INFO
"%s: wavelan_watchdog(): cleanup failed, trying reset\n",
3879 /* Reset watchdog for next transmission. */
3880 if(lp
->tx_n_in_use
> 0)
3882 /* set timer to expire in WATCHDOG_JIFFIES */
3883 lp
->watchdog
.expires
= jiffies
+ WATCHDOG_JIFFIES
;
3884 add_timer(&lp
->watchdog
);
3889 #ifdef DEBUG_INTERRUPT_TRACE
3890 printk(KERN_DEBUG
"%s: <-wavelan_watchdog()\n", dev
->name
);
3894 /********************* CONFIGURATION CALLBACKS *********************/
3896 * Here are the functions called by the Linux networking code (NET3)
3897 * for initialization, configuration and deinstallations of the
3898 * WaveLAN ISA hardware.
3901 /*------------------------------------------------------------------*/
3903 * Configure and start up the WaveLAN PCMCIA adaptor.
3904 * Called by NET3 when it "opens" the device.
3907 wavelan_open(device
* dev
)
3911 #ifdef DEBUG_CALLBACK_TRACE
3912 printk(KERN_DEBUG
"%s: ->wavelan_open(dev=0x%x)\n", dev
->name
,
3913 (unsigned int) dev
);
3919 #ifdef DEBUG_CONFIG_ERROR
3920 printk(KERN_WARNING
"%s: wavelan_open(): no IRQ\n", dev
->name
);
3925 if(request_irq(dev
->irq
, &wavelan_interrupt
, 0, "WaveLAN", dev
) != 0)
3927 #ifdef DEBUG_CONFIG_ERROR
3928 printk(KERN_WARNING
"%s: wavelan_open(): invalid IRQ\n", dev
->name
);
3934 if(wv_hw_reset(dev
) != -1)
3941 free_irq(dev
->irq
, dev
);
3942 #ifdef DEBUG_CONFIG_ERROR
3943 printk(KERN_INFO
"%s: wavelan_open(): impossible to start the card\n",
3952 #ifdef DEBUG_CALLBACK_TRACE
3953 printk(KERN_DEBUG
"%s: <-wavelan_open()\n", dev
->name
);
3958 /*------------------------------------------------------------------*/
3960 * Shut down the WaveLAN ISA card.
3961 * Called by NET3 when it "closes" the device.
3964 wavelan_close(device
* dev
)
3966 net_local
* lp
= (net_local
*)dev
->priv
;
3968 #ifdef DEBUG_CALLBACK_TRACE
3969 printk(KERN_DEBUG
"%s: ->wavelan_close(dev=0x%x)\n", dev
->name
,
3970 (unsigned int) dev
);
3973 /* Don't do the job twice. */
3980 /* If watchdog was activated, kill it! */
3981 if(lp
->watchdog
.prev
!= (timer_list
*) NULL
)
3982 del_timer(&lp
->watchdog
);
3985 * Flush the Tx and disable Rx.
3989 free_irq(dev
->irq
, dev
);
3993 #ifdef DEBUG_CALLBACK_TRACE
3994 printk(KERN_DEBUG
"%s: <-wavelan_close()\n", dev
->name
);
3999 /*------------------------------------------------------------------*/
4001 * Probe an I/O address, and if the WaveLAN is there configure the
4003 * (called by wavelan_probe() and via init_module()).
4006 wavelan_config(device
* dev
)
4008 u_long ioaddr
= dev
->base_addr
;
4013 #ifdef DEBUG_CALLBACK_TRACE
4014 printk(KERN_DEBUG
"%s: ->wavelan_config(dev=0x%x, ioaddr=0x%x)\n", dev
->name
,
4015 (unsigned int)dev
, ioaddr
);
4018 /* Check IRQ argument on command line. */
4021 irq_mask
= wv_irq_to_psa(dev
->irq
);
4025 #ifdef DEBUG_CONFIG_ERROR
4026 printk(KERN_WARNING
"%s: wavelan_config(): invalid IRQ %d ignored.\n",
4027 dev
->name
, dev
->irq
);
4033 #ifdef DEBUG_CONFIG_INFO
4034 printk(KERN_DEBUG
"%s: wavelan_config(): changing IRQ to %d\n",
4035 dev
->name
, dev
->irq
);
4037 psa_write(ioaddr
, HACR_DEFAULT
,
4038 psaoff(0, psa_int_req_no
), &irq_mask
, 1);
4039 /* update the Wavelan checksum */
4040 update_psa_checksum(dev
, ioaddr
, HACR_DEFAULT
);
4041 wv_hacr_reset(ioaddr
);
4045 psa_read(ioaddr
, HACR_DEFAULT
, psaoff(0, psa_int_req_no
), &irq_mask
, 1);
4046 if((irq
= wv_psa_to_irq(irq_mask
)) == -1)
4048 #ifdef DEBUG_CONFIG_ERROR
4049 printk(KERN_INFO
"%s: wavelan_config(): could not wavelan_map_irq(%d).\n",
4050 dev
->name
, irq_mask
);
4057 request_region(ioaddr
, sizeof(ha_t
), "wavelan");
4059 dev
->mem_start
= 0x0000;
4060 dev
->mem_end
= 0x0000;
4063 /* Initialize device structures */
4064 dev
->priv
= kmalloc(sizeof(net_local
), GFP_KERNEL
);
4065 if(dev
->priv
== NULL
)
4067 memset(dev
->priv
, 0x00, sizeof(net_local
));
4068 lp
= (net_local
*)dev
->priv
;
4070 /* Back link to the device structure. */
4072 /* Add the device at the beginning of the linked list. */
4073 lp
->next
= wavelan_list
;
4076 lp
->hacr
= HACR_DEFAULT
;
4078 lp
->watchdog
.function
= wavelan_watchdog
;
4079 lp
->watchdog
.data
= (unsigned long) dev
;
4080 lp
->promiscuous
= 0;
4084 * Fill in the fields of the device structure
4085 * with generic Ethernet values.
4089 dev
->open
= wavelan_open
;
4090 dev
->stop
= wavelan_close
;
4091 dev
->hard_start_xmit
= wavelan_packet_xmit
;
4092 dev
->get_stats
= wavelan_get_stats
;
4093 dev
->set_multicast_list
= &wavelan_set_multicast_list
;
4094 #ifdef SET_MAC_ADDRESS
4095 dev
->set_mac_address
= &wavelan_set_mac_address
;
4096 #endif /* SET_MAC_ADDRESS */
4098 #ifdef WIRELESS_EXT /* if wireless extension exists in the kernel */
4099 dev
->do_ioctl
= wavelan_ioctl
;
4100 dev
->get_wireless_stats
= wavelan_get_wireless_stats
;
4103 dev
->mtu
= WAVELAN_MTU
;
4105 /* Display nice information. */
4108 #ifdef DEBUG_CALLBACK_TRACE
4109 printk(KERN_DEBUG
"%s: <-wavelan_config()\n", dev
->name
);
4114 /*------------------------------------------------------------------*/
4116 * Check for a network adaptor of this type. Return '0' iff one
4117 * exists. There seem to be different interpretations of
4118 * the initial value of dev->base_addr.
4119 * We follow the example in drivers/net/ne.c.
4120 * (called in "Space.c")
4123 wavelan_probe(device
* dev
)
4126 mac_addr mac
; /* MAC address (check existence of WaveLAN) */
4130 #ifdef DEBUG_CALLBACK_TRACE
4131 printk(KERN_DEBUG
"%s: ->wavelan_probe(dev=0x%x (base_addr=0x%x))\n",
4132 dev
->name
, (unsigned int)dev
, (unsigned int)dev
->base_addr
);
4136 if (wv_struct_check() != (char *) NULL
)
4138 printk(KERN_WARNING
"%s: wavelan_probe(): structure/compiler botch: \"%s\"\n",
4139 dev
->name
, wv_struct_check());
4142 #endif /* STRUCT_CHECK */
4144 /* Check the value of the command line parameter for base address. */
4145 base_addr
= dev
->base_addr
;
4147 /* Don't probe at all. */
4150 #ifdef DEBUG_CONFIG_ERROR
4151 printk(KERN_WARNING
"%s: wavelan_probe(): invalid base address\n",
4157 /* Check a single specified location. */
4158 if(base_addr
> 0x100)
4160 /* Check if there is something at this base address */
4161 if((r
= wv_check_ioaddr(base_addr
, mac
)) == 0)
4163 memcpy(dev
->dev_addr
, mac
, 6); /* Copy MAC address. */
4164 r
= wavelan_config(dev
);
4167 #ifdef DEBUG_CONFIG_INFO
4169 printk(KERN_DEBUG
"%s: wavelan_probe(): no device at specified base address (0x%X) or address already in use\n",
4170 dev
->name
, base_addr
);
4173 #ifdef DEBUG_CALLBACK_TRACE
4174 printk(KERN_DEBUG
"%s: <-wavelan_probe()\n", dev
->name
);
4179 /* Scan all possible addresses of the WaveLAN hardware. */
4180 for(i
= 0; i
< NELS(iobase
); i
++)
4182 /* Check whether there is something at this base address. */
4183 if(wv_check_ioaddr(iobase
[i
], mac
) == 0)
4185 dev
->base_addr
= iobase
[i
]; /* Copy base address. */
4186 memcpy(dev
->dev_addr
, mac
, 6); /* Copy MAC address. */
4187 if(wavelan_config(dev
) == 0)
4189 #ifdef DEBUG_CALLBACK_TRACE
4190 printk(KERN_DEBUG
"%s: <-wavelan_probe()\n", dev
->name
);
4197 /* We may have touched base_addr. Another driver may not like it. */
4198 dev
->base_addr
= base_addr
;
4200 #ifdef DEBUG_CONFIG_INFO
4201 printk(KERN_DEBUG
"%s: wavelan_probe(): no device found\n",
4208 /****************************** MODULE ******************************/
4210 * Module entry point: insertion and removal
4214 /*------------------------------------------------------------------*/
4216 * Insertion of the module
4217 * I'm now quite proud of the multi-device support.
4222 mac_addr mac
; /* MAC address (check WaveLAN existence) */
4223 int ret
= -EIO
; /* Return error if no cards found */
4226 #ifdef DEBUG_MODULE_TRACE
4227 printk(KERN_DEBUG
"-> init_module()\n");
4230 /* If probing is asked */
4233 #ifdef DEBUG_CONFIG_ERROR
4234 printk(KERN_WARNING
"WaveLAN init_module(): doing device probing (bad !)\n");
4235 printk(KERN_WARNING
"Specify base addresses while loading module to correct the problem\n");
4238 /* Copy the basic set of address to be probed. */
4239 for(i
= 0; i
< NELS(iobase
); i
++)
4244 /* Loop on all possible base addresses. */
4246 while((io
[++i
] != 0) && (i
< NELS(io
)))
4248 /* Check if there is something at this base address. */
4249 if(wv_check_ioaddr(io
[i
], mac
) == 0)
4253 /* Create device and set basic arguments. */
4254 dev
= kmalloc(sizeof(struct net_device
), GFP_KERNEL
);
4260 memset(dev
, 0x00, sizeof(struct net_device
));
4261 dev
->name
= name
[i
];
4262 dev
->base_addr
= io
[i
];
4264 dev
->init
= &wavelan_config
;
4265 memcpy(dev
->dev_addr
, mac
, 6); /* Copy MAC address. */
4267 /* Try to create the device. */
4268 if(register_netdev(dev
) != 0)
4270 /* Deallocate everything. */
4271 /* Note: if dev->priv is mallocated, there is no way to fail. */
4272 kfree_s(dev
, sizeof(struct net_device
));
4276 /* If at least one device OK, we do not fail */
4279 } /* if there is something at the address */
4280 } /* Loop on all addresses. */
4282 #ifdef DEBUG_CONFIG_ERROR
4283 if(wavelan_list
== (net_local
*) NULL
)
4284 printk(KERN_WARNING
"WaveLAN init_module(): no device found\n");
4287 #ifdef DEBUG_MODULE_TRACE
4288 printk(KERN_DEBUG
"<- init_module()\n");
4293 /*------------------------------------------------------------------*/
4295 * Removal of the module
4298 cleanup_module(void)
4300 #ifdef DEBUG_MODULE_TRACE
4301 printk(KERN_DEBUG
"-> cleanup_module()\n");
4304 /* Loop on all devices and release them. */
4305 while(wavelan_list
!= (net_local
*) NULL
)
4307 device
* dev
= wavelan_list
->dev
;
4309 #ifdef DEBUG_CONFIG_INFO
4310 printk(KERN_DEBUG
"%s: cleanup_module(): removing device at 0x%x\n",
4311 dev
->name
, (unsigned int) dev
);
4314 /* Release the ioport region. */
4315 release_region(dev
->base_addr
, sizeof(ha_t
));
4317 /* Definitely remove the device. */
4318 unregister_netdev(dev
);
4320 /* Unlink the device. */
4321 wavelan_list
= wavelan_list
->next
;
4324 kfree_s(dev
->priv
, sizeof(struct net_local
));
4325 kfree_s(dev
, sizeof(struct net_device
));
4328 #ifdef DEBUG_MODULE_TRACE
4329 printk(KERN_DEBUG
"<- cleanup_module()\n");
4335 * This software may only be used and distributed
4336 * according to the terms of the GNU Public License.
4338 * This software was developed as a component of the
4339 * Linux operating system.
4340 * It is based on other device drivers and information
4341 * either written or supplied by:
4342 * Ajay Bakre (bakre@paul.rutgers.edu),
4343 * Donald Becker (becker@cesdis.gsfc.nasa.gov),
4344 * Loeke Brederveld (Loeke.Brederveld@Utrecht.NCR.com),
4345 * Anders Klemets (klemets@it.kth.se),
4346 * Vladimir V. Kolpakov (w@stier.koenig.ru),
4347 * Marc Meertens (Marc.Meertens@Utrecht.NCR.com),
4348 * Pauline Middelink (middelin@polyware.iaf.nl),
4349 * Robert Morris (rtm@das.harvard.edu),
4350 * Jean Tourrilhes (jt@hplb.hpl.hp.com),
4351 * Girish Welling (welling@paul.rutgers.edu),
4353 * Thanks go also to:
4354 * James Ashton (jaa101@syseng.anu.edu.au),
4355 * Alan Cox (iialan@iiit.swan.ac.uk),
4356 * Allan Creighton (allanc@cs.usyd.edu.au),
4357 * Matthew Geier (matthew@cs.usyd.edu.au),
4358 * Remo di Giovanni (remo@cs.usyd.edu.au),
4359 * Eckhard Grah (grah@wrcs1.urz.uni-wuppertal.de),
4360 * Vipul Gupta (vgupta@cs.binghamton.edu),
4361 * Mark Hagan (mhagan@wtcpost.daytonoh.NCR.COM),
4362 * Tim Nicholson (tim@cs.usyd.edu.au),
4363 * Ian Parkin (ian@cs.usyd.edu.au),
4364 * John Rosenberg (johnr@cs.usyd.edu.au),
4365 * George Rossi (george@phm.gov.au),
4366 * Arthur Scott (arthur@cs.usyd.edu.au),
4368 * for their assistance and advice.
4370 * Please send bug reports, updates, comments to:
4372 * Bruce Janson Email: bruce@cs.usyd.edu.au
4373 * Basser Department of Computer Science Phone: +61-2-9351-3423
4374 * University of Sydney, N.S.W., 2006, AUSTRALIA Fax: +61-2-9351-3838