Deleted Added
full compact
pnphy.c (146734) pnphy.c (150763)
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 146734 2005-05-29 04:42:30Z nyan $");
34__FBSDID("$FreeBSD: head/sys/dev/dc/pnphy.c 150763 2005-09-30 19:39:27Z imp $");
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

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

95};
96
97DRIVER_MODULE(pnphy, miibus, pnphy_driver, pnphy_devclass, 0, 0);
98
99static int pnphy_service(struct mii_softc *, struct mii_data *, int);
100static void pnphy_status(struct mii_softc *);
101
102static int
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

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

95};
96
97DRIVER_MODULE(pnphy, miibus, pnphy_driver, pnphy_devclass, 0, 0);
98
99static int pnphy_service(struct mii_softc *, struct mii_data *, int);
100static void pnphy_status(struct mii_softc *);
101
102static int
103pnphy_probe(dev)
104 device_t dev;
103pnphy_probe(device_t dev)
105{
106 struct mii_attach_args *ma;
107
108 ma = device_get_ivars(dev);
109
110 /*
111 * The dc driver will report the 82c168 vendor and device
112 * ID to let us know that it wants us to attach.
113 */
114 if (ma->mii_id1 != DC_VENDORID_LO ||
115 ma->mii_id2 != DC_DEVICEID_82C168)
116 return(ENXIO);
117
118 device_set_desc(dev, "PNIC 82c168 media interface");
119
120 return (0);
121}
122
123static int
104{
105 struct mii_attach_args *ma;
106
107 ma = device_get_ivars(dev);
108
109 /*
110 * The dc driver will report the 82c168 vendor and device
111 * ID to let us know that it wants us to attach.
112 */
113 if (ma->mii_id1 != DC_VENDORID_LO ||
114 ma->mii_id2 != DC_DEVICEID_82C168)
115 return(ENXIO);
116
117 device_set_desc(dev, "PNIC 82c168 media interface");
118
119 return (0);
120}
121
122static int
124pnphy_attach(dev)
125 device_t dev;
123pnphy_attach(device_t dev)
126{
127 struct mii_softc *sc;
128 struct mii_attach_args *ma;
129 struct mii_data *mii;
130
131 sc = device_get_softc(dev);
132 ma = device_get_ivars(dev);
133 sc->mii_dev = device_get_parent(dev);

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

158
159#undef ADD
160
161 MIIBUS_MEDIAINIT(sc->mii_dev);
162 return(0);
163}
164
165static int
124{
125 struct mii_softc *sc;
126 struct mii_attach_args *ma;
127 struct mii_data *mii;
128
129 sc = device_get_softc(dev);
130 ma = device_get_ivars(dev);
131 sc->mii_dev = device_get_parent(dev);

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

156
157#undef ADD
158
159 MIIBUS_MEDIAINIT(sc->mii_dev);
160 return(0);
161}
162
163static int
166pnphy_service(sc, mii, cmd)
167 struct mii_softc *sc;
168 struct mii_data *mii;
169 int cmd;
164pnphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
170{
171 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
172
173 switch (cmd) {
174 case MII_POLLSTAT:
175 /*
176 * If we're not polling our PHY instance, just return.
177 */

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

241 pnphy_status(sc);
242
243 /* Callback if something changed. */
244 mii_phy_update(sc, cmd);
245 return (0);
246}
247
248static void
165{
166 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
167
168 switch (cmd) {
169 case MII_POLLSTAT:
170 /*
171 * If we're not polling our PHY instance, just return.
172 */

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

236 pnphy_status(sc);
237
238 /* Callback if something changed. */
239 mii_phy_update(sc, cmd);
240 return (0);
241}
242
243static void
249pnphy_status(sc)
250 struct mii_softc *sc;
244pnphy_status(struct mii_softc *sc)
251{
252 struct mii_data *mii = sc->mii_pdata;
253 int reg;
254 struct dc_softc *dc_sc;
255
256 dc_sc = mii->mii_ifp->if_softc;
257
258 mii->mii_media_status = IFM_AVALID;

--- 16 unchanged lines hidden ---
245{
246 struct mii_data *mii = sc->mii_pdata;
247 int reg;
248 struct dc_softc *dc_sc;
249
250 dc_sc = mii->mii_ifp->if_softc;
251
252 mii->mii_media_status = IFM_AVALID;

--- 16 unchanged lines hidden ---