Deleted Added
full compact
if_ste.c (211089) if_ste.c (213893)
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/dev/ste/if_ste.c 211089 2010-08-09 01:47:09Z yongari $");
34__FBSDID("$FreeBSD: head/sys/dev/ste/if_ste.c 213893 2010-10-15 14:52:11Z marius $");
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>

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

364
365static int
366ste_miibus_readreg(device_t dev, int phy, int reg)
367{
368 struct ste_softc *sc;
369 struct ste_mii_frame frame;
370
371 sc = device_get_softc(dev);
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>

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

364
365static int
366ste_miibus_readreg(device_t dev, int phy, int reg)
367{
368 struct ste_softc *sc;
369 struct ste_mii_frame frame;
370
371 sc = device_get_softc(dev);
372
373 if ((sc->ste_flags & STE_FLAG_ONE_PHY) != 0 && phy != 0)
374 return (0);
375
376 bzero((char *)&frame, sizeof(frame));
377
378 frame.mii_phyaddr = phy;
379 frame.mii_regaddr = reg;
380 ste_mii_readreg(sc, &frame);
381
382 return (frame.mii_data);
383}

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

1054 * setup and ethernet/BPF attach.
1055 */
1056static int
1057ste_attach(device_t dev)
1058{
1059 struct ste_softc *sc;
1060 struct ifnet *ifp;
1061 uint16_t eaddr[ETHER_ADDR_LEN / 2];
372 bzero((char *)&frame, sizeof(frame));
373
374 frame.mii_phyaddr = phy;
375 frame.mii_regaddr = reg;
376 ste_mii_readreg(sc, &frame);
377
378 return (frame.mii_data);
379}

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

1050 * setup and ethernet/BPF attach.
1051 */
1052static int
1053ste_attach(device_t dev)
1054{
1055 struct ste_softc *sc;
1056 struct ifnet *ifp;
1057 uint16_t eaddr[ETHER_ADDR_LEN / 2];
1062 int error = 0, pmc, prefer_iomap, rid;
1058 int error = 0, phy, pmc, prefer_iomap, rid;
1063
1064 sc = device_get_softc(dev);
1065 sc->ste_dev = dev;
1066
1067 /*
1068 * Only use one PHY since this chip reports multiple
1069 * Note on the DFE-550 the PHY is at 1 on the DFE-580
1070 * it is at 0 & 1. It is rev 0x12.

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

1143 ifp = sc->ste_ifp = if_alloc(IFT_ETHER);
1144 if (ifp == NULL) {
1145 device_printf(dev, "can not if_alloc()\n");
1146 error = ENOSPC;
1147 goto fail;
1148 }
1149
1150 /* Do MII setup. */
1059
1060 sc = device_get_softc(dev);
1061 sc->ste_dev = dev;
1062
1063 /*
1064 * Only use one PHY since this chip reports multiple
1065 * Note on the DFE-550 the PHY is at 1 on the DFE-580
1066 * it is at 0 & 1. It is rev 0x12.

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

1139 ifp = sc->ste_ifp = if_alloc(IFT_ETHER);
1140 if (ifp == NULL) {
1141 device_printf(dev, "can not if_alloc()\n");
1142 error = ENOSPC;
1143 goto fail;
1144 }
1145
1146 /* Do MII setup. */
1151 if (mii_phy_probe(dev, &sc->ste_miibus,
1152 ste_ifmedia_upd, ste_ifmedia_sts)) {
1153 device_printf(dev, "MII without any phy!\n");
1154 error = ENXIO;
1147 phy = MII_PHY_ANY;
1148 if ((sc->ste_flags & STE_FLAG_ONE_PHY) != 0)
1149 phy = 0;
1150 error = mii_attach(dev, &sc->ste_miibus, ifp, ste_ifmedia_upd,
1151 ste_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
1152 if (error != 0) {
1153 device_printf(dev, "attaching PHYs failed\n");
1155 goto fail;
1156 }
1157
1158 ifp->if_softc = sc;
1159 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
1160 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
1161 ifp->if_ioctl = ste_ioctl;
1162 ifp->if_start = ste_start;

--- 1123 unchanged lines hidden ---
1154 goto fail;
1155 }
1156
1157 ifp->if_softc = sc;
1158 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
1159 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
1160 ifp->if_ioctl = ste_ioctl;
1161 ifp->if_start = ste_start;

--- 1123 unchanged lines hidden ---