pnphy.c (217417) | pnphy.c (221407) |
---|---|
1/* 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ee.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@ee.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/dc/pnphy.c 217417 2011-01-14 20:26:59Z marius $"); | 34__FBSDID("$FreeBSD: head/sys/dev/dc/pnphy.c 221407 2011-05-03 19:51:29Z marius $"); |
35 36/* 37 * Pseudo-driver for media selection on the Lite-On PNIC 82c168 38 * chip. The NWAY support on this chip is horribly broken, so we 39 * only support manual mode selection. This is lame, but getting 40 * NWAY to work right is amazingly difficult. 41 */ 42 --- 42 unchanged lines hidden (view full) --- 85 pnphy_methods, 86 sizeof(struct mii_softc) 87}; 88 89DRIVER_MODULE(pnphy, miibus, pnphy_driver, pnphy_devclass, 0, 0); 90 91static int pnphy_service(struct mii_softc *, struct mii_data *, int); 92static void pnphy_status(struct mii_softc *); | 35 36/* 37 * Pseudo-driver for media selection on the Lite-On PNIC 82c168 38 * chip. The NWAY support on this chip is horribly broken, so we 39 * only support manual mode selection. This is lame, but getting 40 * NWAY to work right is amazingly difficult. 41 */ 42 --- 42 unchanged lines hidden (view full) --- 85 pnphy_methods, 86 sizeof(struct mii_softc) 87}; 88 89DRIVER_MODULE(pnphy, miibus, pnphy_driver, pnphy_devclass, 0, 0); 90 91static int pnphy_service(struct mii_softc *, struct mii_data *, int); 92static void pnphy_status(struct mii_softc *); |
93static void pnphy_reset(struct mii_softc *); |
|
93 | 94 |
95static const struct mii_phy_funcs pnphy_funcs = { 96 pnphy_service, 97 pnphy_status, 98 pnphy_reset 99}; 100 |
|
94static int 95pnphy_probe(device_t dev) 96{ 97 struct mii_attach_args *ma; 98 99 ma = device_get_ivars(dev); 100 101 /* --- 8 unchanged lines hidden (view full) --- 110 111 return (BUS_PROBE_DEFAULT); 112} 113 114static int 115pnphy_attach(device_t dev) 116{ 117 struct mii_softc *sc; | 101static int 102pnphy_probe(device_t dev) 103{ 104 struct mii_attach_args *ma; 105 106 ma = device_get_ivars(dev); 107 108 /* --- 8 unchanged lines hidden (view full) --- 117 118 return (BUS_PROBE_DEFAULT); 119} 120 121static int 122pnphy_attach(device_t dev) 123{ 124 struct mii_softc *sc; |
118 struct mii_attach_args *ma; 119 struct mii_data *mii; | |
120 121 sc = device_get_softc(dev); | 125 126 sc = device_get_softc(dev); |
122 ma = device_get_ivars(dev); 123 sc->mii_dev = device_get_parent(dev); 124 mii = ma->mii_data; 125 LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); | |
126 | 127 |
127 sc->mii_flags = miibus_get_flags(dev); 128 sc->mii_inst = mii->mii_instance++; 129 sc->mii_phy = ma->mii_phyno; 130 sc->mii_service = pnphy_service; 131 sc->mii_pdata = mii; | 128 mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE, 129 &pnphy_funcs, 0); |
132 | 130 |
133 /* 134 * Apparently, we can neither isolate nor do loopback. 135 */ 136 sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; 137 | |
138 sc->mii_capabilities = 139 BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX | BMSR_10THDX; | 131 sc->mii_capabilities = 132 BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX | BMSR_10THDX; |
140 sc->mii_capabilities &= ma->mii_capmask; | 133 sc->mii_capabilities &= sc->mii_capmask; |
141 device_printf(dev, " "); 142 mii_phy_add_media(sc); 143 printf("\n"); 144 145 MIIBUS_MEDIAINIT(sc->mii_dev); 146 return (0); 147} 148 --- 40 unchanged lines hidden (view full) --- 189 */ 190 if ((mii->mii_ifp->if_flags & IFF_UP) == 0) 191 return (0); 192 193 break; 194 } 195 196 /* Update the media status. */ | 134 device_printf(dev, " "); 135 mii_phy_add_media(sc); 136 printf("\n"); 137 138 MIIBUS_MEDIAINIT(sc->mii_dev); 139 return (0); 140} 141 --- 40 unchanged lines hidden (view full) --- 182 */ 183 if ((mii->mii_ifp->if_flags & IFF_UP) == 0) 184 return (0); 185 186 break; 187 } 188 189 /* Update the media status. */ |
197 pnphy_status(sc); | 190 PHY_STATUS(sc); |
198 199 /* Callback if something changed. */ 200 mii_phy_update(sc, cmd); 201 return (0); 202} 203 204static void 205pnphy_status(struct mii_softc *sc) --- 15 unchanged lines hidden (view full) --- 221 mii->mii_media_active |= IFM_10_T; 222 else 223 mii->mii_media_active |= IFM_100_TX; 224 if (reg & DC_NETCFG_FULLDUPLEX) 225 mii->mii_media_active |= IFM_FDX; 226 else 227 mii->mii_media_active |= IFM_HDX; 228} | 191 192 /* Callback if something changed. */ 193 mii_phy_update(sc, cmd); 194 return (0); 195} 196 197static void 198pnphy_status(struct mii_softc *sc) --- 15 unchanged lines hidden (view full) --- 214 mii->mii_media_active |= IFM_10_T; 215 else 216 mii->mii_media_active |= IFM_100_TX; 217 if (reg & DC_NETCFG_FULLDUPLEX) 218 mii->mii_media_active |= IFM_FDX; 219 else 220 mii->mii_media_active |= IFM_HDX; 221} |
222 223static void 224pnphy_reset(struct mii_softc *sc __unused) 225{ 226 227} |
|