pnphy.c (95667) | pnphy.c (95722) |
---|---|
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 --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 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 * | 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 --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 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 * $FreeBSD: head/sys/dev/dc/pnphy.c 95667 2002-04-28 19:25:07Z phk $ | 32 * $FreeBSD: head/sys/dev/dc/pnphy.c 95722 2002-04-29 13:07:38Z phk $ |
33 */ 34 35/* 36 * Pseudo-driver for media selection on the Lite-On PNIC 82c168 37 * chip. The NWAY support on this chip is horribly broken, so we 38 * only support manual mode selection. This is lame, but getting 39 * NWAY to work right is amazingly difficult. 40 */ --- 23 unchanged lines hidden (view full) --- 64#include <sys/bus.h> 65 66#include <pci/if_dcreg.h> 67 68#include "miibus_if.h" 69 70#if !defined(lint) 71static const char rcsid[] = | 33 */ 34 35/* 36 * Pseudo-driver for media selection on the Lite-On PNIC 82c168 37 * chip. The NWAY support on this chip is horribly broken, so we 38 * only support manual mode selection. This is lame, but getting 39 * NWAY to work right is amazingly difficult. 40 */ --- 23 unchanged lines hidden (view full) --- 64#include <sys/bus.h> 65 66#include <pci/if_dcreg.h> 67 68#include "miibus_if.h" 69 70#if !defined(lint) 71static const char rcsid[] = |
72 "$FreeBSD: head/sys/dev/dc/pnphy.c 95667 2002-04-28 19:25:07Z phk $"; | 72 "$FreeBSD: head/sys/dev/dc/pnphy.c 95722 2002-04-29 13:07:38Z phk $"; |
73#endif 74 75#define DC_SETBIT(sc, reg, x) \ 76 CSR_WRITE_4(sc, reg, \ 77 CSR_READ_4(sc, reg) | x) 78 79#define DC_CLRBIT(sc, reg, x) \ 80 CSR_WRITE_4(sc, reg, \ 81 CSR_READ_4(sc, reg) & ~x) 82 83static int pnphy_probe (device_t); 84static int pnphy_attach (device_t); | 73#endif 74 75#define DC_SETBIT(sc, reg, x) \ 76 CSR_WRITE_4(sc, reg, \ 77 CSR_READ_4(sc, reg) | x) 78 79#define DC_CLRBIT(sc, reg, x) \ 80 CSR_WRITE_4(sc, reg, \ 81 CSR_READ_4(sc, reg) & ~x) 82 83static int pnphy_probe (device_t); 84static int pnphy_attach (device_t); |
85static int pnphy_detach (device_t); | |
86 87static device_method_t pnphy_methods[] = { 88 /* device interface */ 89 DEVMETHOD(device_probe, pnphy_probe), 90 DEVMETHOD(device_attach, pnphy_attach), | 85 86static device_method_t pnphy_methods[] = { 87 /* device interface */ 88 DEVMETHOD(device_probe, pnphy_probe), 89 DEVMETHOD(device_attach, pnphy_attach), |
91 DEVMETHOD(device_detach, pnphy_detach), | 90 DEVMETHOD(device_detach, mii_phy_detach), |
92 DEVMETHOD(device_shutdown, bus_generic_shutdown), 93 { 0, 0 } 94}; 95 96static devclass_t pnphy_devclass; 97 98static driver_t pnphy_driver = { 99 "pnphy", --- 62 unchanged lines hidden (view full) --- 162 BMCR_LOOP|BMCR_S100); 163 164#undef ADD 165 166 MIIBUS_MEDIAINIT(sc->mii_dev); 167 return(0); 168} 169 | 91 DEVMETHOD(device_shutdown, bus_generic_shutdown), 92 { 0, 0 } 93}; 94 95static devclass_t pnphy_devclass; 96 97static driver_t pnphy_driver = { 98 "pnphy", --- 62 unchanged lines hidden (view full) --- 161 BMCR_LOOP|BMCR_S100); 162 163#undef ADD 164 165 MIIBUS_MEDIAINIT(sc->mii_dev); 166 return(0); 167} 168 |
170static int pnphy_detach(dev) 171 device_t dev; 172{ 173 struct mii_softc *sc; 174 struct mii_data *mii; 175 176 sc = device_get_softc(dev); 177 mii = device_get_softc(device_get_parent(dev)); 178 sc->mii_dev = NULL; 179 LIST_REMOVE(sc, mii_list); 180 181 return(0); 182} 183 | |
184static int 185pnphy_service(sc, mii, cmd) 186 struct mii_softc *sc; 187 struct mii_data *mii; 188 int cmd; 189{ 190 struct dc_softc *dc_sc; 191 struct ifmedia_entry *ife = mii->mii_media.ifm_cur; --- 108 unchanged lines hidden --- | 169static int 170pnphy_service(sc, mii, cmd) 171 struct mii_softc *sc; 172 struct mii_data *mii; 173 int cmd; 174{ 175 struct dc_softc *dc_sc; 176 struct ifmedia_entry *ife = mii->mii_media.ifm_cur; --- 108 unchanged lines hidden --- |