Lines Matching +full:test2 +full:. +full:zeros
4 * Copyright (c) 1996 Gardner Buchanan <gbuchanan@shl.com>
5 * All rights reserved.
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
17 * This product includes software developed by Gardner Buchanan.
18 * 4. The name of Gardner Buchanan may not be used to endorse or promote
20 * permission.
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include <sys/cdefs.h>
38 * This is a driver for SMC's 9000 series of Ethernet adapters.
41 * Erik Stahlman and is Copyright (C) 1996 by Erik Stahlman.
43 * which is Copyright (C) 1994 Herb Peyerl <hpeyerl@novatel.ca>
44 * All rights reserved.
47 * PC. It is adapted from Erik Stahlman's Linux driver which worked
48 * with his EFA Info*Express SVC VLB adaptor. According to SMC's databook,
49 * it will work for the entire SMC 9xxx series. (Ha Ha)
52 * 4608 byte packet memory. (for the 91C92. Others have more)
57 * Erik Stahlman erik@vt.edu
58 * Herb Peyerl hpeyerl@novatel.ca
59 * Andres Vega Garcia avega@sophia.inria.fr
60 * Serge Babkin babkin@hq.icb.chel.su
61 * Gardner Buchanan gbuchanan@shl.com
65 * o "smc9194.c:v0.10(FIXED) 02/15/96 by Erik Stahlman (erik@vt.edu)"
66 * o "if_ep.c,v 1.19 1995/01/24 20:53:45 davidg Exp"
69 * o Setting of the hardware address isn't supported.
70 * o Hardware padding isn't used.
76 * Copyright (c) 1996 by Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org>
77 * BSD-nomads, Tokyo, Japan.
80 * Multicast support by Kei TANAKA <kei@pal.xerox.com>
81 * Special thanks to itojun@itojun.org
84 #include <sys/param.h>
85 #include <sys/systm.h>
86 #include <sys/errno.h>
87 #include <sys/kernel.h>
88 #include <sys/sockio.h>
89 #include <sys/malloc.h>
90 #include <sys/mbuf.h>
91 #include <sys/socket.h>
92 #include <sys/syslog.h>
94 #include <sys/module.h>
95 #include <sys/bus.h>
97 #include <machine/bus.h>
98 #include <machine/resource.h>
99 #include <sys/rman.h>
101 #include <net/ethernet.h>
102 #include <net/if.h>
103 #include <net/if_var.h>
104 #include <net/if_arp.h>
105 #include <net/if_dl.h>
106 #include <net/if_types.h>
107 #include <net/if_mib.h>
110 #include <netinet/in.h>
111 #include <netinet/in_systm.h>
112 #include <netinet/in_var.h>
113 #include <netinet/ip.h>
116 #include <net/bpf.h>
117 #include <net/bpfdesc.h>
119 #include <dev/sn/if_snreg.h>
120 #include <dev/sn/if_snvar.h>
143 * to work properly.
196 * Read the station address from the chip. The MAC address is bank 1, in sn_attach()
214 ifp->if_snd.ifq_maxlen = ifqmaxlen; in sn_attach()
220 * Activate the interrupt so we can get card interrupts. This in sn_attach()
222 * during startup to avoid LORs in the network layer. in sn_attach()
278 * EEPROM. After the reset cycle, we pause briefly for the chip to in sninit_locked()
279 * be happy. in sninit_locked()
293 * memory) and to enable the EPH interrupt on certain TX errors. in sninit_locked()
305 * Reset the MMU and wait for it to be un-busy. in sninit_locked()
320 * Set the transmitter control. We want it enabled. in sninit_locked()
326 * I (GB) have been unlucky getting this to work. in sninit_locked()
350 * Mark the interface running but not active. in sninit_locked()
357 * Attempt to push out any waiting packets. in sninit_locked()
400 m = ifp->if_snd.ifq_head; in snstart_locked()
405 * number of bytes. Below we assume that the packet length is even. in snstart_locked()
413 * We drop packets that are too large. Perhaps we should truncate in snstart_locked()
426 * If HW padding is not turned on, then pad to ETHER_MIN_LEN. in snstart_locked()
437 * 'pages', minus 1 (A packet can't ever have 0 pages. We also in snstart_locked()
439 * the allocation request. in snstart_locked()
452 * completes. Otherwise, I enable the interrupt and wait for in snstart_locked()
453 * completion asynchronously. in snstart_locked()
465 * No memory now. Oh well, wait until the chip finds memory in snstart_locked()
466 * later. Remember how many pages we were asking for and in snstart_locked()
467 * enable the allocation completion interrupt. Also set a in snstart_locked()
468 * watchdog in case we miss the interrupt. We mark the in snstart_locked()
470 * snstart() until after the memory is available. in snstart_locked()
482 * The memory allocation completed. Check the results. in snstart_locked()
491 * We have a packet number, so tell the card to use it. in snstart_locked()
502 * and the status word (set to zeros) in snstart_locked()
509 * Get the packet from the kernel. This will include the Ethernet in snstart_locked()
510 * frame header, MAC Addresses etc. in snstart_locked()
515 * Push out the data to the card. in snstart_locked()
520 * Push out words. in snstart_locked()
526 * Push out remaining byte. in snstart_locked()
534 * Push out padding. in snstart_locked()
546 * desired. in snstart_locked()
552 * watchdog in case we miss the interrupt. in snstart_locked()
573 * RX FIFO. If nothing has arrived then attempt to queue another in snstart_locked()
574 * transmit packet. in snstart_locked()
584 * has completed.
587 * a completed memory allocation the same way snstart() does.
589 * packets.
614 m = ifp->if_snd.ifq_head; in snresume()
621 * number of bytes. Below we assume that the packet length is even. in snresume()
629 * We drop packets that are too large. Perhaps we should truncate in snresume()
642 * If HW padding is not turned on, then pad to ETHER_MIN_LEN. in snresume()
654 * 'pages', minus 1 (A packet can't ever have 0 pages. We also in snresume()
656 * the allocation request. in snresume()
664 * The memory allocation completed. Check the results. If it failed, in snresume()
665 * we simply set a watchdog timer and hope for the best. in snresume()
669 if_printf(ifp, "Memory allocation failed. Weird.\n"); in snresume()
674 * We have a packet number, so tell the card to use it. in snresume()
680 * memory allocation was initiated. in snresume()
683 if_printf(ifp, "memory allocation wrong size. Weird.\n"); in snresume()
686 * memory once it is granted. Wait for the MMU to be un-busy. in snresume()
701 * and the status word (set to zeros) in snresume()
708 * Get the packet from the kernel. This will include the Ethernet in snresume()
709 * frame header, MAC Addresses etc. in snresume()
714 * Push out the data to the card. in snresume()
719 * Push out words. in snresume()
724 * Push out remaining byte. in snresume()
732 * Push out padding. in snresume()
744 * desired. in snresume()
750 * watchdog in case we miss the interrupt. in snresume()
771 * We've sent something, so we're active. Set a watchdog in case the in snresume()
772 * TX_EMPTY interrupt is lost. in snresume()
805 * Clear the watchdog. in snintr_locked()
813 * while servicing interrupts. in snintr_locked()
820 * are masked. in snintr_locked()
826 * Now, process each of the interrupt types. in snintr_locked()
830 * Receive Overrun. in snintr_locked()
842 * Got a packet. in snintr_locked()
860 * An on-card memory allocation came through. in snintr_locked()
864 * Disable this interrupt. in snintr_locked()
871 * TX Completion. Handle a transmit error message. This will only be in snintr_locked()
872 * called when there is an error, because of the AUTO_RELEASE mode. in snintr_locked()
895 * Fetch the TX status word. The value found here will be a in snintr_locked()
897 * failed. in snintr_locked()
912 * Some of these errors will have disabled transmit. in snintr_locked()
913 * Re-enable transmit now. in snintr_locked()
924 * kill the failed packet. Wait for the MMU to be un-busy. in snintr_locked()
932 * Attempt to queue more transmits. in snintr_locked()
938 * Transmit underrun. We use this opportunity to update transmit in snintr_locked()
939 * statistics from the card. in snintr_locked()
950 * Disable this interrupt. in snintr_locked()
970 * Attempt to enqueue some more stuff. in snintr_locked()
976 * Some other error. Try to fix it by resetting the adapter. in snintr_locked()
985 * Handled all interrupt sources. in snintr_locked()
992 * during this interrupt. Note that the hardware mask, which was set in snintr_locked()
995 * those new interrupts stay enabled here. in snintr_locked()
1029 * Start reading from the start of the packet. Since PTR_RCV is set, in snread()
1030 * packet number is found in FIFO_PORTS_REG_W, FIFO_RX_MASK. in snread()
1042 * extra word with the control byte. in snread()
1047 * Account for receive errors and discard. in snread()
1054 * A packet is received. in snread()
1058 * Adjust for odd-length packet. in snread()
1064 * Allocate a header mbuf from the kernel. in snread()
1070 m->m_pkthdr.rcvif = ifp; in snread()
1071 m->m_pkthdr.len = m->m_len = packet_length; in snread()
1074 * Attach an mbuf cluster. in snread()
1085 * Get packet, including link layer address, from interface. in snread()
1096 * Remove link layer addresses and whatnot. in snread()
1098 m->m_pkthdr.len = m->m_len = packet_length; in snread()
1102 * snstart() in the netisr case. This would result in a in snread()
1103 * lock reversal. Better performance might be obtained by in snread()
1105 * calling if_input() on each one. in snread()
1115 * the MMU to be un-busy. in snread()
1134 * Handle IOCTLS. This function is completely stolen from if_ep.c
1136 * changes.
1159 /* update multicast filter list. */ in snioctl()
1186 /* 1. zero the interrupt mask
1187 * 2. clear the enable receive flag
1188 * 3. clear the enable xmit flags
1197 * Clear interrupt mask; disable all interrupts. in snstop()
1210 * Cancel watchdog. in snstop()
1271 * Tests to see if a given ioaddr points to an SMC9xxx chip.
1272 * Tries to cause as little damage as possible if it's not a SMC chip.
1306 * test this. Go to bank 0, then test that the register still in sn_probe()
1307 * reports the high byte is 0x33. in sn_probe()
1313 device_printf(dev, "test2 failed\n"); in sn_probe()
1319 * hurt. This time, I need to switch the bank register to bank 1, so in sn_probe()
1320 * I can access the base address register. The contents of the in sn_probe()
1322 * to match the I/O port address where the adapter is being probed. in sn_probe()
1330 * Well, the base address register didn't match. Must not in sn_probe()
1331 * have been a SMC chip after all. in sn_probe()
1342 * Check if the revision register is something that I recognize. in sn_probe()
1344 * be added. in sn_probe()
1351 * I don't regonize this chip, so... in sn_probe()
1360 * at this point I'll assume that the chip is an SMC9xxx. It might be in sn_probe()
1362 * address, or do some other tests. in sn_probe()
1383 * Set the receiver filter. We want receive enabled and auto strip in sn_setmcast()
1384 * of CRC from received packet. If we are promiscuous then set that in sn_setmcast()
1385 * bit too. in sn_setmcast()