Deleted Added
full compact
if_tl.c (87846) if_tl.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_tl.c 87846 2001-12-14 05:56:35Z luigi $
32 * $FreeBSD: head/sys/pci/if_tl.c 92739 2002-03-20 02:08:01Z alfred $
33 */
34
35/*
36 * Texas Instruments ThunderLAN driver for FreeBSD 2.2.6 and 3.x.
37 * Supports many Compaq PCI NICs based on the ThunderLAN ethernet controller,
38 * the National Semiconductor DP83840A physical interface and the
39 * Microchip Technology 24Cxx series serial EEPROM.
40 *

--- 179 unchanged lines hidden (view full) ---

220
221MODULE_DEPEND(tl, miibus, 1, 1, 1);
222
223/* "controller miibus0" required. See GENERIC if you get errors here. */
224#include "miibus_if.h"
225
226#if !defined(lint)
227static const char rcsid[] =
33 */
34
35/*
36 * Texas Instruments ThunderLAN driver for FreeBSD 2.2.6 and 3.x.
37 * Supports many Compaq PCI NICs based on the ThunderLAN ethernet controller,
38 * the National Semiconductor DP83840A physical interface and the
39 * Microchip Technology 24Cxx series serial EEPROM.
40 *

--- 179 unchanged lines hidden (view full) ---

220
221MODULE_DEPEND(tl, miibus, 1, 1, 1);
222
223/* "controller miibus0" required. See GENERIC if you get errors here. */
224#include "miibus_if.h"
225
226#if !defined(lint)
227static const char rcsid[] =
228 "$FreeBSD: head/sys/pci/if_tl.c 87846 2001-12-14 05:56:35Z luigi $";
228 "$FreeBSD: head/sys/pci/if_tl.c 92739 2002-03-20 02:08:01Z alfred $";
229#endif
230
231/*
232 * Various supported device vendors/types and their names.
233 */
234
235static struct tl_type tl_devs[] = {
236 { TI_VENDORID, TI_DEVICEID_THUNDERLAN,

--- 22 unchanged lines hidden (view full) ---

259 "Olicom OC-2183/2185" },
260 { OLICOM_VENDORID, OLICOM_DEVICEID_OC2325,
261 "Olicom OC-2325" },
262 { OLICOM_VENDORID, OLICOM_DEVICEID_OC2326,
263 "Olicom OC-2326 10/100 TX UTP" },
264 { 0, 0, NULL }
265};
266
229#endif
230
231/*
232 * Various supported device vendors/types and their names.
233 */
234
235static struct tl_type tl_devs[] = {
236 { TI_VENDORID, TI_DEVICEID_THUNDERLAN,

--- 22 unchanged lines hidden (view full) ---

259 "Olicom OC-2183/2185" },
260 { OLICOM_VENDORID, OLICOM_DEVICEID_OC2325,
261 "Olicom OC-2325" },
262 { OLICOM_VENDORID, OLICOM_DEVICEID_OC2326,
263 "Olicom OC-2326 10/100 TX UTP" },
264 { 0, 0, NULL }
265};
266
267static int tl_probe __P((device_t));
268static int tl_attach __P((device_t));
269static int tl_detach __P((device_t));
270static int tl_intvec_rxeoc __P((void *, u_int32_t));
271static int tl_intvec_txeoc __P((void *, u_int32_t));
272static int tl_intvec_txeof __P((void *, u_int32_t));
273static int tl_intvec_rxeof __P((void *, u_int32_t));
274static int tl_intvec_adchk __P((void *, u_int32_t));
275static int tl_intvec_netsts __P((void *, u_int32_t));
267static int tl_probe (device_t);
268static int tl_attach (device_t);
269static int tl_detach (device_t);
270static int tl_intvec_rxeoc (void *, u_int32_t);
271static int tl_intvec_txeoc (void *, u_int32_t);
272static int tl_intvec_txeof (void *, u_int32_t);
273static int tl_intvec_rxeof (void *, u_int32_t);
274static int tl_intvec_adchk (void *, u_int32_t);
275static int tl_intvec_netsts (void *, u_int32_t);
276
276
277static int tl_newbuf __P((struct tl_softc *,
278 struct tl_chain_onefrag *));
279static void tl_stats_update __P((void *));
280static int tl_encap __P((struct tl_softc *, struct tl_chain *,
281 struct mbuf *));
277static int tl_newbuf (struct tl_softc *, struct tl_chain_onefrag *);
278static void tl_stats_update (void *);
279static int tl_encap (struct tl_softc *, struct tl_chain *,
280 struct mbuf *);
282
281
283static void tl_intr __P((void *));
284static void tl_start __P((struct ifnet *));
285static int tl_ioctl __P((struct ifnet *, u_long, caddr_t));
286static void tl_init __P((void *));
287static void tl_stop __P((struct tl_softc *));
288static void tl_watchdog __P((struct ifnet *));
289static void tl_shutdown __P((device_t));
290static int tl_ifmedia_upd __P((struct ifnet *));
291static void tl_ifmedia_sts __P((struct ifnet *, struct ifmediareq *));
282static void tl_intr (void *);
283static void tl_start (struct ifnet *);
284static int tl_ioctl (struct ifnet *, u_long, caddr_t);
285static void tl_init (void *);
286static void tl_stop (struct tl_softc *);
287static void tl_watchdog (struct ifnet *);
288static void tl_shutdown (device_t);
289static int tl_ifmedia_upd (struct ifnet *);
290static void tl_ifmedia_sts (struct ifnet *, struct ifmediareq *);
292
291
293static u_int8_t tl_eeprom_putbyte __P((struct tl_softc *, int));
294static u_int8_t tl_eeprom_getbyte __P((struct tl_softc *,
295 int, u_int8_t *));
296static int tl_read_eeprom __P((struct tl_softc *, caddr_t, int, int));
292static u_int8_t tl_eeprom_putbyte (struct tl_softc *, int);
293static u_int8_t tl_eeprom_getbyte (struct tl_softc *, int, u_int8_t *);
294static int tl_read_eeprom (struct tl_softc *, caddr_t, int, int);
297
295
298static void tl_mii_sync __P((struct tl_softc *));
299static void tl_mii_send __P((struct tl_softc *, u_int32_t, int));
300static int tl_mii_readreg __P((struct tl_softc *, struct tl_mii_frame *));
301static int tl_mii_writereg __P((struct tl_softc *, struct tl_mii_frame *));
302static int tl_miibus_readreg __P((device_t, int, int));
303static int tl_miibus_writereg __P((device_t, int, int, int));
304static void tl_miibus_statchg __P((device_t));
296static void tl_mii_sync (struct tl_softc *);
297static void tl_mii_send (struct tl_softc *, u_int32_t, int);
298static int tl_mii_readreg (struct tl_softc *, struct tl_mii_frame *);
299static int tl_mii_writereg (struct tl_softc *, struct tl_mii_frame *);
300static int tl_miibus_readreg (device_t, int, int);
301static int tl_miibus_writereg (device_t, int, int, int);
302static void tl_miibus_statchg (device_t);
305
303
306static void tl_setmode __P((struct tl_softc *, int));
307static int tl_calchash __P((caddr_t));
308static void tl_setmulti __P((struct tl_softc *));
309static void tl_setfilt __P((struct tl_softc *, caddr_t, int));
310static void tl_softreset __P((struct tl_softc *, int));
311static void tl_hardreset __P((device_t));
312static int tl_list_rx_init __P((struct tl_softc *));
313static int tl_list_tx_init __P((struct tl_softc *));
304static void tl_setmode (struct tl_softc *, int);
305static int tl_calchash (caddr_t);
306static void tl_setmulti (struct tl_softc *);
307static void tl_setfilt (struct tl_softc *, caddr_t, int);
308static void tl_softreset (struct tl_softc *, int);
309static void tl_hardreset (device_t);
310static int tl_list_rx_init (struct tl_softc *);
311static int tl_list_tx_init (struct tl_softc *);
314
312
315static u_int8_t tl_dio_read8 __P((struct tl_softc *, int));
316static u_int16_t tl_dio_read16 __P((struct tl_softc *, int));
317static u_int32_t tl_dio_read32 __P((struct tl_softc *, int));
318static void tl_dio_write8 __P((struct tl_softc *, int, int));
319static void tl_dio_write16 __P((struct tl_softc *, int, int));
320static void tl_dio_write32 __P((struct tl_softc *, int, int));
321static void tl_dio_setbit __P((struct tl_softc *, int, int));
322static void tl_dio_clrbit __P((struct tl_softc *, int, int));
323static void tl_dio_setbit16 __P((struct tl_softc *, int, int));
324static void tl_dio_clrbit16 __P((struct tl_softc *, int, int));
313static u_int8_t tl_dio_read8 (struct tl_softc *, int);
314static u_int16_t tl_dio_read16 (struct tl_softc *, int);
315static u_int32_t tl_dio_read32 (struct tl_softc *, int);
316static void tl_dio_write8 (struct tl_softc *, int, int);
317static void tl_dio_write16 (struct tl_softc *, int, int);
318static void tl_dio_write32 (struct tl_softc *, int, int);
319static void tl_dio_setbit (struct tl_softc *, int, int);
320static void tl_dio_clrbit (struct tl_softc *, int, int);
321static void tl_dio_setbit16 (struct tl_softc *, int, int);
322static void tl_dio_clrbit16 (struct tl_softc *, int, int);
325
326#ifdef TL_USEIOSPACE
327#define TL_RES SYS_RES_IOPORT
328#define TL_RID TL_PCI_LOIO
329#else
330#define TL_RES SYS_RES_MEMORY
331#define TL_RID TL_PCI_LOMEM
332#endif

--- 2004 unchanged lines hidden ---
323
324#ifdef TL_USEIOSPACE
325#define TL_RES SYS_RES_IOPORT
326#define TL_RID TL_PCI_LOIO
327#else
328#define TL_RES SYS_RES_MEMORY
329#define TL_RID TL_PCI_LOMEM
330#endif

--- 2004 unchanged lines hidden ---