if_xl.c (88079) | if_xl.c (92739) |
---|---|
1/* 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * | 1/* 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * |
32 * $FreeBSD: head/sys/pci/if_xl.c 88079 2001-12-17 22:24:19Z silby $ | 32 * $FreeBSD: head/sys/pci/if_xl.c 92739 2002-03-20 02:08:01Z alfred $ |
33 */ 34 35/* 36 * 3Com 3c90x Etherlink XL PCI NIC driver 37 * 38 * Supports the 3Com "boomerang", "cyclone" and "hurricane" PCI 39 * bus-master chips (3c90x cards and embedded controllers) including 40 * the following: --- 106 unchanged lines hidden (view full) --- 147 * might not work on some devices. 148 */ 149#define XL_USEIOSPACE 150 151#include <pci/if_xlreg.h> 152 153#if !defined(lint) 154static const char rcsid[] = | 33 */ 34 35/* 36 * 3Com 3c90x Etherlink XL PCI NIC driver 37 * 38 * Supports the 3Com "boomerang", "cyclone" and "hurricane" PCI 39 * bus-master chips (3c90x cards and embedded controllers) including 40 * the following: --- 106 unchanged lines hidden (view full) --- 147 * might not work on some devices. 148 */ 149#define XL_USEIOSPACE 150 151#include <pci/if_xlreg.h> 152 153#if !defined(lint) 154static const char rcsid[] = |
155 "$FreeBSD: head/sys/pci/if_xl.c 88079 2001-12-17 22:24:19Z silby $"; | 155 "$FreeBSD: head/sys/pci/if_xl.c 92739 2002-03-20 02:08:01Z alfred $"; |
156#endif 157 158#define XL905B_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) 159 160/* 161 * Various supported device vendors/types and their names. 162 */ 163static struct xl_type xl_devs[] = { --- 45 unchanged lines hidden (view full) --- 209 "3Com 3c656 Fast Etherlink XL" }, 210 { TC_VENDORID, TC_DEVICEID_HURRICANE_656B, 211 "3Com 3c656B Fast Etherlink XL" }, 212 { TC_VENDORID, TC_DEVICEID_TORNADO_656C, 213 "3Com 3c656C Fast Etherlink XL" }, 214 { 0, 0, NULL } 215}; 216 | 156#endif 157 158#define XL905B_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) 159 160/* 161 * Various supported device vendors/types and their names. 162 */ 163static struct xl_type xl_devs[] = { --- 45 unchanged lines hidden (view full) --- 209 "3Com 3c656 Fast Etherlink XL" }, 210 { TC_VENDORID, TC_DEVICEID_HURRICANE_656B, 211 "3Com 3c656B Fast Etherlink XL" }, 212 { TC_VENDORID, TC_DEVICEID_TORNADO_656C, 213 "3Com 3c656C Fast Etherlink XL" }, 214 { 0, 0, NULL } 215}; 216 |
217static int xl_probe __P((device_t)); 218static int xl_attach __P((device_t)); 219static int xl_detach __P((device_t)); | 217static int xl_probe (device_t); 218static int xl_attach (device_t); 219static int xl_detach (device_t); |
220 | 220 |
221static int xl_newbuf __P((struct xl_softc *, 222 struct xl_chain_onefrag *)); 223static void xl_stats_update __P((void *)); 224static int xl_encap __P((struct xl_softc *, struct xl_chain *, 225 struct mbuf * )); 226static int xl_encap_90xB __P((struct xl_softc *, struct xl_chain *, 227 struct mbuf * )); | 221static int xl_newbuf (struct xl_softc *, struct xl_chain_onefrag *); 222static void xl_stats_update (void *); 223static int xl_encap (struct xl_softc *, struct xl_chain *, 224 struct mbuf *); 225static int xl_encap_90xB (struct xl_softc *, struct xl_chain *, 226 struct mbuf *); |
228 | 227 |
229static void xl_rxeof __P((struct xl_softc *)); 230static int xl_rx_resync __P((struct xl_softc *)); 231static void xl_txeof __P((struct xl_softc *)); 232static void xl_txeof_90xB __P((struct xl_softc *)); 233static void xl_txeoc __P((struct xl_softc *)); 234static void xl_intr __P((void *)); 235static void xl_start __P((struct ifnet *)); 236static void xl_start_90xB __P((struct ifnet *)); 237static int xl_ioctl __P((struct ifnet *, u_long, caddr_t)); 238static void xl_init __P((void *)); 239static void xl_stop __P((struct xl_softc *)); 240static void xl_watchdog __P((struct ifnet *)); 241static void xl_shutdown __P((device_t)); 242static int xl_suspend __P((device_t)); 243static int xl_resume __P((device_t)); | 228static void xl_rxeof (struct xl_softc *); 229static int xl_rx_resync (struct xl_softc *); 230static void xl_txeof (struct xl_softc *); 231static void xl_txeof_90xB (struct xl_softc *); 232static void xl_txeoc (struct xl_softc *); 233static void xl_intr (void *); 234static void xl_start (struct ifnet *); 235static void xl_start_90xB (struct ifnet *); 236static int xl_ioctl (struct ifnet *, u_long, caddr_t); 237static void xl_init (void *); 238static void xl_stop (struct xl_softc *); 239static void xl_watchdog (struct ifnet *); 240static void xl_shutdown (device_t); 241static int xl_suspend (device_t); 242static int xl_resume (device_t); |
244 | 243 |
245static int xl_ifmedia_upd __P((struct ifnet *)); 246static void xl_ifmedia_sts __P((struct ifnet *, struct ifmediareq *)); | 244static int xl_ifmedia_upd (struct ifnet *); 245static void xl_ifmedia_sts (struct ifnet *, struct ifmediareq *); |
247 | 246 |
248static int xl_eeprom_wait __P((struct xl_softc *)); 249static int xl_read_eeprom __P((struct xl_softc *, caddr_t, int, 250 int, int)); 251static void xl_mii_sync __P((struct xl_softc *)); 252static void xl_mii_send __P((struct xl_softc *, u_int32_t, int)); 253static int xl_mii_readreg __P((struct xl_softc *, struct xl_mii_frame *)); 254static int xl_mii_writereg __P((struct xl_softc *, struct xl_mii_frame *)); | 247static int xl_eeprom_wait (struct xl_softc *); 248static int xl_read_eeprom (struct xl_softc *, caddr_t, int, int, int); 249static void xl_mii_sync (struct xl_softc *); 250static void xl_mii_send (struct xl_softc *, u_int32_t, int); 251static int xl_mii_readreg (struct xl_softc *, struct xl_mii_frame *); 252static int xl_mii_writereg (struct xl_softc *, struct xl_mii_frame *); |
255 | 253 |
256static void xl_setcfg __P((struct xl_softc *)); 257static void xl_setmode __P((struct xl_softc *, int)); 258static u_int8_t xl_calchash __P((caddr_t)); 259static void xl_setmulti __P((struct xl_softc *)); 260static void xl_setmulti_hash __P((struct xl_softc *)); 261static void xl_reset __P((struct xl_softc *)); 262static int xl_list_rx_init __P((struct xl_softc *)); 263static int xl_list_tx_init __P((struct xl_softc *)); 264static int xl_list_tx_init_90xB __P((struct xl_softc *)); 265static void xl_wait __P((struct xl_softc *)); 266static void xl_mediacheck __P((struct xl_softc *)); 267static void xl_choose_xcvr __P((struct xl_softc *, int)); | 254static void xl_setcfg (struct xl_softc *); 255static void xl_setmode (struct xl_softc *, int); 256static u_int8_t xl_calchash (caddr_t); 257static void xl_setmulti (struct xl_softc *); 258static void xl_setmulti_hash (struct xl_softc *); 259static void xl_reset (struct xl_softc *); 260static int xl_list_rx_init (struct xl_softc *); 261static int xl_list_tx_init (struct xl_softc *); 262static int xl_list_tx_init_90xB (struct xl_softc *); 263static void xl_wait (struct xl_softc *); 264static void xl_mediacheck (struct xl_softc *); 265static void xl_choose_xcvr (struct xl_softc *, int); |
268#ifdef notdef | 266#ifdef notdef |
269static void xl_testpacket __P((struct xl_softc *)); | 267static void xl_testpacket (struct xl_softc *); |
270#endif 271 | 268#endif 269 |
272static int xl_miibus_readreg __P((device_t, int, int)); 273static int xl_miibus_writereg __P((device_t, int, int, int)); 274static void xl_miibus_statchg __P((device_t)); 275static void xl_miibus_mediainit __P((device_t)); | 270static int xl_miibus_readreg (device_t, int, int); 271static int xl_miibus_writereg (device_t, int, int, int); 272static void xl_miibus_statchg (device_t); 273static void xl_miibus_mediainit (device_t); |
276 277#ifdef XL_USEIOSPACE 278#define XL_RES SYS_RES_IOPORT 279#define XL_RID XL_PCI_LOIO 280#else 281#define XL_RES SYS_RES_MEMORY 282#define XL_RID XL_PCI_LOMEM 283#endif --- 2800 unchanged lines hidden --- | 274 275#ifdef XL_USEIOSPACE 276#define XL_RES SYS_RES_IOPORT 277#define XL_RID XL_PCI_LOIO 278#else 279#define XL_RES SYS_RES_MEMORY 280#define XL_RID XL_PCI_LOMEM 281#endif --- 2800 unchanged lines hidden --- |