Deleted Added
full compact
if_xl.c (142398) if_xl.c (142407)
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

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

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
33#include <sys/cdefs.h>
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

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

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
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/pci/if_xl.c 142398 2005-02-24 21:32:56Z imp $");
34__FBSDID("$FreeBSD: head/sys/pci/if_xl.c 142407 2005-02-24 22:33:05Z imp $");
35
36/*
37 * 3Com 3c90x Etherlink XL PCI NIC driver
38 *
39 * Supports the 3Com "boomerang", "cyclone" and "hurricane" PCI
40 * bus-master chips (3c90x cards and embedded controllers) including
41 * the following:
42 *

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

214 "3Com 3c656 Fast Etherlink XL" },
215 { TC_VENDORID, TC_DEVICEID_HURRICANE_656B,
216 "3Com 3c656B Fast Etherlink XL" },
217 { TC_VENDORID, TC_DEVICEID_TORNADO_656C,
218 "3Com 3c656C Fast Etherlink XL" },
219 { 0, 0, NULL }
220};
221
35
36/*
37 * 3Com 3c90x Etherlink XL PCI NIC driver
38 *
39 * Supports the 3Com "boomerang", "cyclone" and "hurricane" PCI
40 * bus-master chips (3c90x cards and embedded controllers) including
41 * the following:
42 *

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

214 "3Com 3c656 Fast Etherlink XL" },
215 { TC_VENDORID, TC_DEVICEID_HURRICANE_656B,
216 "3Com 3c656B Fast Etherlink XL" },
217 { TC_VENDORID, TC_DEVICEID_TORNADO_656C,
218 "3Com 3c656C Fast Etherlink XL" },
219 { 0, 0, NULL }
220};
221
222static int xl_probe (device_t);
223static int xl_attach (device_t);
224static int xl_detach (device_t);
222static int xl_probe(device_t);
223static int xl_attach(device_t);
224static int xl_detach(device_t);
225
225
226static int xl_newbuf (struct xl_softc *, struct xl_chain_onefrag *);
227static void xl_stats_update (void *);
228static void xl_stats_update_locked
229 (struct xl_softc *);
230static int xl_encap (struct xl_softc *, struct xl_chain *,
231 struct mbuf *);
232static void xl_rxeof (struct xl_softc *);
233static int xl_rx_resync (struct xl_softc *);
234static void xl_txeof (struct xl_softc *);
235static void xl_txeof_90xB (struct xl_softc *);
236static void xl_txeoc (struct xl_softc *);
237static void xl_intr (void *);
238static void xl_start (struct ifnet *);
239static void xl_start_locked (struct ifnet *);
240static void xl_start_90xB_locked
241 (struct ifnet *);
242static int xl_ioctl (struct ifnet *, u_long, caddr_t);
243static void xl_init (void *);
244static void xl_init_locked (struct xl_softc *);
245static void xl_stop (struct xl_softc *);
246static void xl_watchdog (struct ifnet *);
247static void xl_shutdown (device_t);
248static int xl_suspend (device_t);
249static int xl_resume (device_t);
226static int xl_newbuf(struct xl_softc *, struct xl_chain_onefrag *);
227static void xl_stats_update(void *);
228static void xl_stats_update_locked(struct xl_softc *);
229static int xl_encap(struct xl_softc *, struct xl_chain *, struct mbuf *);
230static void xl_rxeof(struct xl_softc *);
231static int xl_rx_resync(struct xl_softc *);
232static void xl_txeof(struct xl_softc *);
233static void xl_txeof_90xB(struct xl_softc *);
234static void xl_txeoc(struct xl_softc *);
235static void xl_intr(void *);
236static void xl_start(struct ifnet *);
237static void xl_start_locked(struct ifnet *);
238static void xl_start_90xB_locked(struct ifnet *);
239static int xl_ioctl(struct ifnet *, u_long, caddr_t);
240static void xl_init(void *);
241static void xl_init_locked(struct xl_softc *);
242static void xl_stop(struct xl_softc *);
243static void xl_watchdog(struct ifnet *);
244static void xl_shutdown(device_t);
245static int xl_suspend(device_t);
246static int xl_resume(device_t);
250
247
251static int xl_ifmedia_upd (struct ifnet *);
252static void xl_ifmedia_sts (struct ifnet *, struct ifmediareq *);
248static int xl_ifmedia_upd(struct ifnet *);
249static void xl_ifmedia_sts(struct ifnet *, struct ifmediareq *);
253
250
254static int xl_eeprom_wait (struct xl_softc *);
255static int xl_read_eeprom (struct xl_softc *, caddr_t, int, int, int);
256static void xl_mii_sync (struct xl_softc *);
257static void xl_mii_send (struct xl_softc *, u_int32_t, int);
258static int xl_mii_readreg (struct xl_softc *, struct xl_mii_frame *);
259static int xl_mii_writereg (struct xl_softc *, struct xl_mii_frame *);
251static int xl_eeprom_wait(struct xl_softc *);
252static int xl_read_eeprom(struct xl_softc *, caddr_t, int, int, int);
253static void xl_mii_sync(struct xl_softc *);
254static void xl_mii_send(struct xl_softc *, u_int32_t, int);
255static int xl_mii_readreg(struct xl_softc *, struct xl_mii_frame *);
256static int xl_mii_writereg(struct xl_softc *, struct xl_mii_frame *);
260
257
261static void xl_setcfg (struct xl_softc *);
262static void xl_setmode (struct xl_softc *, int);
263static void xl_setmulti (struct xl_softc *);
264static void xl_setmulti_hash (struct xl_softc *);
265static void xl_reset (struct xl_softc *);
266static int xl_list_rx_init (struct xl_softc *);
267static int xl_list_tx_init (struct xl_softc *);
268static int xl_list_tx_init_90xB (struct xl_softc *);
269static void xl_wait (struct xl_softc *);
270static void xl_mediacheck (struct xl_softc *);
271static void xl_choose_media (struct xl_softc *sc, int *media);
272static void xl_choose_xcvr (struct xl_softc *, int);
273static void xl_dma_map_addr (void *, bus_dma_segment_t *, int, int);
274static void xl_dma_map_rxbuf (void *, bus_dma_segment_t *, int, bus_size_t,
275 int);
276static void xl_dma_map_txbuf (void *, bus_dma_segment_t *, int, bus_size_t,
277 int);
258static void xl_setcfg(struct xl_softc *);
259static void xl_setmode(struct xl_softc *, int);
260static void xl_setmulti(struct xl_softc *);
261static void xl_setmulti_hash(struct xl_softc *);
262static void xl_reset(struct xl_softc *);
263static int xl_list_rx_init(struct xl_softc *);
264static int xl_list_tx_init(struct xl_softc *);
265static int xl_list_tx_init_90xB(struct xl_softc *);
266static void xl_wait(struct xl_softc *);
267static void xl_mediacheck(struct xl_softc *);
268static void xl_choose_media(struct xl_softc *sc, int *media);
269static void xl_choose_xcvr(struct xl_softc *, int);
270static void xl_dma_map_addr(void *, bus_dma_segment_t *, int, int);
271static void xl_dma_map_rxbuf(void *, bus_dma_segment_t *, int, bus_size_t, int);
272static void xl_dma_map_txbuf(void *, bus_dma_segment_t *, int, bus_size_t, int);
278#ifdef notdef
273#ifdef notdef
279static void xl_testpacket (struct xl_softc *);
274static void xl_testpacket(struct xl_softc *);
280#endif
281
275#endif
276
282static int xl_miibus_readreg (device_t, int, int);
283static int xl_miibus_writereg (device_t, int, int, int);
284static void xl_miibus_statchg (device_t);
285static void xl_miibus_mediainit (device_t);
277static int xl_miibus_readreg(device_t, int, int);
278static int xl_miibus_writereg(device_t, int, int, int);
279static void xl_miibus_statchg(device_t);
280static void xl_miibus_mediainit(device_t);
286
287static device_method_t xl_methods[] = {
288 /* Device interface */
289 DEVMETHOD(device_probe, xl_probe),
290 DEVMETHOD(device_attach, xl_attach),
291 DEVMETHOD(device_detach, xl_detach),
292 DEVMETHOD(device_shutdown, xl_shutdown),
293 DEVMETHOD(device_suspend, xl_suspend),

--- 2958 unchanged lines hidden ---
281
282static device_method_t xl_methods[] = {
283 /* Device interface */
284 DEVMETHOD(device_probe, xl_probe),
285 DEVMETHOD(device_attach, xl_attach),
286 DEVMETHOD(device_detach, xl_detach),
287 DEVMETHOD(device_shutdown, xl_shutdown),
288 DEVMETHOD(device_suspend, xl_suspend),

--- 2958 unchanged lines hidden ---