Deleted Added
full compact
if_txp.c (173665) if_txp.c (173666)
1/* $OpenBSD: if_txp.c,v 1.48 2001/06/27 06:34:50 kjc Exp $ */
2
3/*-
4 * Copyright (c) 2001
5 * Jason L. Wright <jason@thought.net>, Theo de Raadt, and
6 * Aaron Campbell <aaron@monkey.org>. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34 * THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
1/* $OpenBSD: if_txp.c,v 1.48 2001/06/27 06:34:50 kjc Exp $ */
2
3/*-
4 * Copyright (c) 2001
5 * Jason L. Wright <jason@thought.net>, Theo de Raadt, and
6 * Aaron Campbell <aaron@monkey.org>. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34 * THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/dev/txp/if_txp.c 173665 2007-11-16 10:25:36Z yongari $");
38__FBSDID("$FreeBSD: head/sys/dev/txp/if_txp.c 173666 2007-11-16 10:32:10Z yongari $");
39
40/*
41 * Driver for 3c990 (Typhoon) Ethernet ASIC
42 */
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/sockio.h>
46#include <sys/mbuf.h>

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

82#define TXP_USEIOSPACE
83#define __STRICT_ALIGNMENT
84
85#include <dev/txp/if_txpreg.h>
86#include <dev/txp/3c990img.h>
87
88#ifndef lint
89static const char rcsid[] =
39
40/*
41 * Driver for 3c990 (Typhoon) Ethernet ASIC
42 */
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/sockio.h>
46#include <sys/mbuf.h>

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

82#define TXP_USEIOSPACE
83#define __STRICT_ALIGNMENT
84
85#include <dev/txp/if_txpreg.h>
86#include <dev/txp/3c990img.h>
87
88#ifndef lint
89static const char rcsid[] =
90 "$FreeBSD: head/sys/dev/txp/if_txp.c 173665 2007-11-16 10:25:36Z yongari $";
90 "$FreeBSD: head/sys/dev/txp/if_txp.c 173666 2007-11-16 10:32:10Z yongari $";
91#endif
92
93/*
94 * Various supported device vendors/types and their names.
95 */
96static struct txp_type txp_devs[] = {
97 { TXP_VENDORID_3COM, TXP_DEVICEID_3CR990_TX_95,
98 "3Com 3cR990-TX-95 Etherlink with 3XP Processor" },

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

1650
1651static void
1652txp_ifmedia_sts(ifp, ifmr)
1653 struct ifnet *ifp;
1654 struct ifmediareq *ifmr;
1655{
1656 struct txp_softc *sc = ifp->if_softc;
1657 struct ifmedia *ifm = &sc->sc_ifmedia;
91#endif
92
93/*
94 * Various supported device vendors/types and their names.
95 */
96static struct txp_type txp_devs[] = {
97 { TXP_VENDORID_3COM, TXP_DEVICEID_3CR990_TX_95,
98 "3Com 3cR990-TX-95 Etherlink with 3XP Processor" },

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

1650
1651static void
1652txp_ifmedia_sts(ifp, ifmr)
1653 struct ifnet *ifp;
1654 struct ifmediareq *ifmr;
1655{
1656 struct txp_softc *sc = ifp->if_softc;
1657 struct ifmedia *ifm = &sc->sc_ifmedia;
1658 u_int16_t bmsr, bmcr, anlpar;
1658 u_int16_t bmsr, bmcr, anar, anlpar;
1659
1660 ifmr->ifm_status = IFM_AVALID;
1661 ifmr->ifm_active = IFM_ETHER;
1662
1663 TXP_LOCK(sc);
1664 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_BMSR, 0,
1665 &bmsr, NULL, NULL, 1))
1666 goto bail;
1667 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_BMSR, 0,
1668 &bmsr, NULL, NULL, 1))
1669 goto bail;
1670
1671 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_BMCR, 0,
1672 &bmcr, NULL, NULL, 1))
1673 goto bail;
1674
1675 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_ANLPAR, 0,
1676 &anlpar, NULL, NULL, 1))
1677 goto bail;
1659
1660 ifmr->ifm_status = IFM_AVALID;
1661 ifmr->ifm_active = IFM_ETHER;
1662
1663 TXP_LOCK(sc);
1664 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_BMSR, 0,
1665 &bmsr, NULL, NULL, 1))
1666 goto bail;
1667 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_BMSR, 0,
1668 &bmsr, NULL, NULL, 1))
1669 goto bail;
1670
1671 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_BMCR, 0,
1672 &bmcr, NULL, NULL, 1))
1673 goto bail;
1674
1675 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_ANLPAR, 0,
1676 &anlpar, NULL, NULL, 1))
1677 goto bail;
1678
1679 if (txp_command(sc, TXP_CMD_PHY_MGMT_READ, 0, MII_ANAR, 0,
1680 &anar, NULL, NULL, 1))
1681 goto bail;
1678 TXP_UNLOCK(sc);
1679
1680 if (bmsr & BMSR_LINK)
1681 ifmr->ifm_status |= IFM_ACTIVE;
1682
1683 if (bmcr & BMCR_ISO) {
1684 ifmr->ifm_active |= IFM_NONE;
1685 ifmr->ifm_status = 0;

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

1690 ifmr->ifm_active |= IFM_LOOP;
1691
1692 if (bmcr & BMCR_AUTOEN) {
1693 if ((bmsr & BMSR_ACOMP) == 0) {
1694 ifmr->ifm_active |= IFM_NONE;
1695 return;
1696 }
1697
1682 TXP_UNLOCK(sc);
1683
1684 if (bmsr & BMSR_LINK)
1685 ifmr->ifm_status |= IFM_ACTIVE;
1686
1687 if (bmcr & BMCR_ISO) {
1688 ifmr->ifm_active |= IFM_NONE;
1689 ifmr->ifm_status = 0;

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

1694 ifmr->ifm_active |= IFM_LOOP;
1695
1696 if (bmcr & BMCR_AUTOEN) {
1697 if ((bmsr & BMSR_ACOMP) == 0) {
1698 ifmr->ifm_active |= IFM_NONE;
1699 return;
1700 }
1701
1702 anlpar &= anar;
1698 if (anlpar & ANLPAR_TX_FD)
1699 ifmr->ifm_active |= IFM_100_TX|IFM_FDX;
1700 else if (anlpar & ANLPAR_T4)
1701 ifmr->ifm_active |= IFM_100_T4;
1702 else if (anlpar & ANLPAR_TX)
1703 ifmr->ifm_active |= IFM_100_TX;
1704 else if (anlpar & ANLPAR_10_FD)
1705 ifmr->ifm_active |= IFM_10_T|IFM_FDX;

--- 195 unchanged lines hidden ---
1703 if (anlpar & ANLPAR_TX_FD)
1704 ifmr->ifm_active |= IFM_100_TX|IFM_FDX;
1705 else if (anlpar & ANLPAR_T4)
1706 ifmr->ifm_active |= IFM_100_T4;
1707 else if (anlpar & ANLPAR_TX)
1708 ifmr->ifm_active |= IFM_100_TX;
1709 else if (anlpar & ANLPAR_10_FD)
1710 ifmr->ifm_active |= IFM_10_T|IFM_FDX;

--- 195 unchanged lines hidden ---