Deleted Added
sdiff udiff text old ( 200908 ) new ( 200910 )
full compact
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/dev/ste/if_ste.c 200908 2009-12-23 18:42:25Z yongari $");
35
36#ifdef HAVE_KERNEL_OPTION_HEADERS
37#include "opt_device_polling.h"
38#endif
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/bus.h>

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

120static int ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *);
121static int ste_read_eeprom(struct ste_softc *, caddr_t, int, int, int);
122static void ste_reset(struct ste_softc *);
123static void ste_restart_tx(struct ste_softc *);
124static int ste_rxeof(struct ste_softc *, int);
125static void ste_rxfilter(struct ste_softc *);
126static void ste_start(struct ifnet *);
127static void ste_start_locked(struct ifnet *);
128static void ste_stats_update(struct ste_softc *);
129static void ste_stop(struct ste_softc *);
130static void ste_tick(void *);
131static void ste_txeoc(struct ste_softc *);
132static void ste_txeof(struct ste_softc *);
133static void ste_wait(struct ste_softc *);
134static void ste_watchdog(struct ste_softc *);
135
136static device_method_t ste_methods[] = {
137 /* Device interface */

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

918 }
919
920 sc->ste_cdata.ste_tx_cons = idx;
921 if (sc->ste_cdata.ste_tx_cnt == 0)
922 sc->ste_timer = 0;
923}
924
925static void
926ste_stats_update(struct ste_softc *sc)
927{
928 struct ifnet *ifp;
929
930 STE_LOCK_ASSERT(sc);
931
932 ifp = sc->ste_ifp;
933 ifp->if_collisions += CSR_READ_1(sc, STE_LATE_COLLS)
934 + CSR_READ_1(sc, STE_MULTI_COLLS)
935 + CSR_READ_1(sc, STE_SINGLE_COLLS);
936}
937
938/*
939 * Probe for a Sundance ST201 chip. Check the PCI vendor and device
940 * IDs against our list and return a device name if we find a match.
941 */
942static int
943ste_probe(device_t dev)

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

1027 * Get station address from the EEPROM.
1028 */
1029 if (ste_read_eeprom(sc, eaddr,
1030 STE_EEADDR_NODE0, 3, 0)) {
1031 device_printf(dev, "failed to read station address\n");
1032 error = ENXIO;;
1033 goto fail;
1034 }
1035
1036 if ((error = ste_dma_alloc(sc)) != 0)
1037 goto fail;
1038
1039 ifp = sc->ste_ifp = if_alloc(IFT_ETHER);
1040 if (ifp == NULL) {
1041 device_printf(dev, "can not if_alloc()\n");
1042 error = ENOSPC;

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

1620 /* Enable receiver and transmitter */
1621 CSR_WRITE_2(sc, STE_MACCTL0, 0);
1622 CSR_WRITE_2(sc, STE_MACCTL1, 0);
1623 STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_TX_ENABLE);
1624 STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_RX_ENABLE);
1625
1626 /* Enable stats counters. */
1627 STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_STATS_ENABLE);
1628
1629 CSR_WRITE_2(sc, STE_ISR, 0xFFFF);
1630#ifdef DEVICE_POLLING
1631 /* Disable interrupts if we are polling. */
1632 if (ifp->if_capenable & IFCAP_POLLING)
1633 CSR_WRITE_2(sc, STE_IMR, 0);
1634 else
1635#endif

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

2008 sc = device_get_softc(dev);
2009
2010 STE_LOCK(sc);
2011 ste_stop(sc);
2012 STE_UNLOCK(sc);
2013
2014 return (0);
2015}