Deleted Added
full compact
rlphy.c (165985) rlphy.c (165991)
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/mii/rlphy.c 165985 2007-01-12 22:27:46Z marius $");
34__FBSDID("$FreeBSD: head/sys/dev/mii/rlphy.c 165991 2007-01-13 00:17:39Z marius $");
35
36/*
37 * driver for RealTek 8139 internal PHYs
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>

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

77 sizeof(struct mii_softc)
78};
79
80DRIVER_MODULE(rlphy, miibus, rlphy_driver, rlphy_devclass, 0, 0);
81
82static int rlphy_service(struct mii_softc *, struct mii_data *, int);
83static void rlphy_status(struct mii_softc *);
84
35
36/*
37 * driver for RealTek 8139 internal PHYs
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>

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

77 sizeof(struct mii_softc)
78};
79
80DRIVER_MODULE(rlphy, miibus, rlphy_driver, rlphy_devclass, 0, 0);
81
82static int rlphy_service(struct mii_softc *, struct mii_data *, int);
83static void rlphy_status(struct mii_softc *);
84
85/*
86 * RealTek internal PHYs don't have vendor/device ID registers;
87 * re(4) and rl(4) fake up a return value of all zeros.
88 */
89static const struct mii_phydesc rlintphys[] = {
90 { 0, 0, "RealTek internal media interface" },
91 MII_PHY_END
92};
93
85static const struct mii_phydesc rlphys[] = {
86 MII_PHY_DESC(REALTEK, RTL8201L),
87 MII_PHY_END
88};
89
90static int
91rlphy_probe(device_t dev)
92{
94static const struct mii_phydesc rlphys[] = {
95 MII_PHY_DESC(REALTEK, RTL8201L),
96 MII_PHY_END
97};
98
99static int
100rlphy_probe(device_t dev)
101{
93 struct mii_attach_args *ma;
94 const char *nic;
95 int rv;
96
97 rv = mii_phy_dev_probe(dev, rlphys, BUS_PROBE_DEFAULT);
98 if (rv <= 0)
99 return (rv);
100
102 const char *nic;
103 int rv;
104
105 rv = mii_phy_dev_probe(dev, rlphys, BUS_PROBE_DEFAULT);
106 if (rv <= 0)
107 return (rv);
108
101 /*
102 * RealTek interal PHYs don't have vendor/device ID registers;
103 * the `re' and `rl' drivers fake up a return value of all zeros.
104 */
105 ma = device_get_ivars(dev);
106 if (MII_OUI(ma->mii_id1, ma->mii_id2) != 0 ||
107 MII_MODEL(ma->mii_id2) != 0)
108 return (ENXIO);
109
110 /*
111 * Make sure the parent is an `rl' or an `re'.
112 */
113 nic = device_get_name(device_get_parent(device_get_parent(dev)));
109 nic = device_get_name(device_get_parent(device_get_parent(dev)));
114 if (strcmp(nic, "rl") != 0 && strcmp(nic, "re") != 0)
115 return (ENXIO);
116
117 device_set_desc(dev, "RealTek internal media interface");
118
119 return (BUS_PROBE_DEFAULT);
110 if (strcmp(nic, "rl") == 0 && strcmp(nic, "re") == 0)
111 return (mii_phy_dev_probe(dev, rlintphys, BUS_PROBE_DEFAULT));
112 return (ENXIO);
120}
121
122static int
123rlphy_attach(device_t dev)
124{
125 struct mii_softc *sc;
126 struct mii_attach_args *ma;
127 struct mii_data *mii;

--- 183 unchanged lines hidden ---
113}
114
115static int
116rlphy_attach(device_t dev)
117{
118 struct mii_softc *sc;
119 struct mii_attach_args *ma;
120 struct mii_data *mii;

--- 183 unchanged lines hidden ---