if_rl.c (90548) | if_rl.c (92739) |
---|---|
1/* 2 * Copyright (c) 1997, 1998 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 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_rl.c 90548 2002-02-11 23:38:30Z silby $ | 32 * $FreeBSD: head/sys/pci/if_rl.c 92739 2002-03-20 02:08:01Z alfred $ |
33 */ 34 35/* 36 * RealTek 8129/8139 PCI NIC driver 37 * 38 * Supports several extremely cheap PCI 10/100 adapters based on 39 * the RealTek chipset. Datasheets can be obtained from 40 * www.realtek.com.tw. --- 85 unchanged lines hidden (view full) --- 126 * uniprocessor systems though. 127 */ 128#define RL_USEIOSPACE 129 130#include <pci/if_rlreg.h> 131 132#ifndef lint 133static const char rcsid[] = | 33 */ 34 35/* 36 * RealTek 8129/8139 PCI NIC driver 37 * 38 * Supports several extremely cheap PCI 10/100 adapters based on 39 * the RealTek chipset. Datasheets can be obtained from 40 * www.realtek.com.tw. --- 85 unchanged lines hidden (view full) --- 126 * uniprocessor systems though. 127 */ 128#define RL_USEIOSPACE 129 130#include <pci/if_rlreg.h> 131 132#ifndef lint 133static const char rcsid[] = |
134 "$FreeBSD: head/sys/pci/if_rl.c 90548 2002-02-11 23:38:30Z silby $"; | 134 "$FreeBSD: head/sys/pci/if_rl.c 92739 2002-03-20 02:08:01Z alfred $"; |
135#endif 136 137/* 138 * Various supported device vendors/types and their names. 139 */ 140static struct rl_type rl_devs[] = { 141 { RT_VENDORID, RT_DEVICEID_8129, 142 "RealTek 8129 10/100BaseTX" }, --- 7 unchanged lines hidden (view full) --- 150 "Delta Electronics 8139 10/100BaseTX" }, 151 { ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, 152 "Addtron Technolgy 8139 10/100BaseTX" }, 153 { DLINK_VENDORID, DLINK_DEVICEID_530TXPLUS, 154 "D-Link DFE-530TX+ 10/100BaseTX" }, 155 { 0, 0, NULL } 156}; 157 | 135#endif 136 137/* 138 * Various supported device vendors/types and their names. 139 */ 140static struct rl_type rl_devs[] = { 141 { RT_VENDORID, RT_DEVICEID_8129, 142 "RealTek 8129 10/100BaseTX" }, --- 7 unchanged lines hidden (view full) --- 150 "Delta Electronics 8139 10/100BaseTX" }, 151 { ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, 152 "Addtron Technolgy 8139 10/100BaseTX" }, 153 { DLINK_VENDORID, DLINK_DEVICEID_530TXPLUS, 154 "D-Link DFE-530TX+ 10/100BaseTX" }, 155 { 0, 0, NULL } 156}; 157 |
158static int rl_probe __P((device_t)); 159static int rl_attach __P((device_t)); 160static int rl_detach __P((device_t)); | 158static int rl_probe (device_t); 159static int rl_attach (device_t); 160static int rl_detach (device_t); |
161 | 161 |
162static int rl_encap __P((struct rl_softc *, struct mbuf * )); | 162static int rl_encap (struct rl_softc *, struct mbuf * ); |
163 | 163 |
164static void rl_rxeof __P((struct rl_softc *)); 165static void rl_txeof __P((struct rl_softc *)); 166static void rl_intr __P((void *)); 167static void rl_tick __P((void *)); 168static void rl_start __P((struct ifnet *)); 169static int rl_ioctl __P((struct ifnet *, u_long, caddr_t)); 170static void rl_init __P((void *)); 171static void rl_stop __P((struct rl_softc *)); 172static void rl_watchdog __P((struct ifnet *)); 173static int rl_suspend __P((device_t)); 174static int rl_resume __P((device_t)); 175static void rl_shutdown __P((device_t)); 176static int rl_ifmedia_upd __P((struct ifnet *)); 177static void rl_ifmedia_sts __P((struct ifnet *, struct ifmediareq *)); | 164static void rl_rxeof (struct rl_softc *); 165static void rl_txeof (struct rl_softc *); 166static void rl_intr (void *); 167static void rl_tick (void *); 168static void rl_start (struct ifnet *); 169static int rl_ioctl (struct ifnet *, u_long, caddr_t); 170static void rl_init (void *); 171static void rl_stop (struct rl_softc *); 172static void rl_watchdog (struct ifnet *); 173static int rl_suspend (device_t); 174static int rl_resume (device_t); 175static void rl_shutdown (device_t); 176static int rl_ifmedia_upd (struct ifnet *); 177static void rl_ifmedia_sts (struct ifnet *, struct ifmediareq *); |
178 | 178 |
179static void rl_eeprom_putbyte __P((struct rl_softc *, int)); 180static void rl_eeprom_getword __P((struct rl_softc *, int, u_int16_t *)); 181static void rl_read_eeprom __P((struct rl_softc *, caddr_t, 182 int, int, int)); 183static void rl_mii_sync __P((struct rl_softc *)); 184static void rl_mii_send __P((struct rl_softc *, u_int32_t, int)); 185static int rl_mii_readreg __P((struct rl_softc *, struct rl_mii_frame *)); 186static int rl_mii_writereg __P((struct rl_softc *, struct rl_mii_frame *)); | 179static void rl_eeprom_putbyte (struct rl_softc *, int); 180static void rl_eeprom_getword (struct rl_softc *, int, u_int16_t *); 181static void rl_read_eeprom (struct rl_softc *, caddr_t, int, int, int); 182static void rl_mii_sync (struct rl_softc *); 183static void rl_mii_send (struct rl_softc *, u_int32_t, int); 184static int rl_mii_readreg (struct rl_softc *, struct rl_mii_frame *); 185static int rl_mii_writereg (struct rl_softc *, struct rl_mii_frame *); |
187 | 186 |
188static int rl_miibus_readreg __P((device_t, int, int)); 189static int rl_miibus_writereg __P((device_t, int, int, int)); 190static void rl_miibus_statchg __P((device_t)); | 187static int rl_miibus_readreg (device_t, int, int); 188static int rl_miibus_writereg (device_t, int, int, int); 189static void rl_miibus_statchg (device_t); |
191 | 190 |
192static u_int8_t rl_calchash __P((caddr_t)); 193static void rl_setmulti __P((struct rl_softc *)); 194static void rl_reset __P((struct rl_softc *)); 195static int rl_list_tx_init __P((struct rl_softc *)); | 191static u_int8_t rl_calchash (caddr_t); 192static void rl_setmulti (struct rl_softc *); 193static void rl_reset (struct rl_softc *); 194static int rl_list_tx_init (struct rl_softc *); |
196 | 195 |
197static void rl_dma_map_rxbuf __P((void *, bus_dma_segment_t *, 198 int, int)); 199static void rl_dma_map_txbuf __P((void *, bus_dma_segment_t *, 200 int, int)); | 196static void rl_dma_map_rxbuf (void *, bus_dma_segment_t *, int, int); 197static void rl_dma_map_txbuf (void *, bus_dma_segment_t *, int, int); |
201 202#ifdef RL_USEIOSPACE 203#define RL_RES SYS_RES_IOPORT 204#define RL_RID RL_PCI_LOIO 205#else 206#define RL_RES SYS_RES_MEMORY 207#define RL_RID RL_PCI_LOMEM 208#endif --- 1618 unchanged lines hidden --- | 198 199#ifdef RL_USEIOSPACE 200#define RL_RES SYS_RES_IOPORT 201#define RL_RID RL_PCI_LOIO 202#else 203#define RL_RES SYS_RES_MEMORY 204#define RL_RID RL_PCI_LOMEM 205#endif --- 1618 unchanged lines hidden --- |