Deleted Added
full compact
octe.c (213762) octe.c (213893)
1/*-
2 * Copyright (c) 2010 Juli Mallett <jmallett@FreeBSD.org>
3 * 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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2010 Juli Mallett <jmallett@FreeBSD.org>
3 * 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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/mips/cavium/octe/octe.c 213762 2010-10-13 09:17:44Z jmallett $
26 * $FreeBSD: head/sys/mips/cavium/octe/octe.c 213893 2010-10-15 14:52:11Z marius $
27 */
28
29/*
30 * Cavium Octeon Ethernet devices.
31 *
32 * XXX This file should be moved to if_octe.c
33 * XXX The driver may have sufficient locking but we need locking to protect
34 * the interfaces presented here, right?

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

152
153 priv = device_get_softc(dev);
154 ifp = priv->ifp;
155
156 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
157
158 if (priv->phy_id != -1) {
159 if (priv->phy_device == NULL) {
27 */
28
29/*
30 * Cavium Octeon Ethernet devices.
31 *
32 * XXX This file should be moved to if_octe.c
33 * XXX The driver may have sufficient locking but we need locking to protect
34 * the interfaces presented here, right?

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

152
153 priv = device_get_softc(dev);
154 ifp = priv->ifp;
155
156 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
157
158 if (priv->phy_id != -1) {
159 if (priv->phy_device == NULL) {
160 error = mii_phy_probe(dev, &priv->miibus, octe_mii_medchange,
161 octe_mii_medstat);
160 error = mii_attach(dev, &priv->miibus, ifp,
161 octe_mii_medchange, octe_mii_medstat,
162 BMSR_DEFCAPMASK, priv->phy_id, MII_OFFSET_ANY, 0);
162 if (error != 0)
163 if (error != 0)
163 device_printf(dev, "missing phy %u\n", priv->phy_id);
164 device_printf(dev, "attaching PHYs failed\n");
164 } else {
165 child = device_add_child(dev, priv->phy_device, -1);
166 if (child == NULL)
167 device_printf(dev, "missing phy %u device %s\n", priv->phy_id, priv->phy_device);
168 }
169 }
170
171 if (priv->miibus == NULL) {

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

234 * Try interface-specific MII routine.
235 */
236 if (priv->mdio_read != NULL)
237 return (priv->mdio_read(priv->ifp, phy, reg));
238
239 /*
240 * Try generic MII routine.
241 */
165 } else {
166 child = device_add_child(dev, priv->phy_device, -1);
167 if (child == NULL)
168 device_printf(dev, "missing phy %u device %s\n", priv->phy_id, priv->phy_device);
169 }
170 }
171
172 if (priv->miibus == NULL) {

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

235 * Try interface-specific MII routine.
236 */
237 if (priv->mdio_read != NULL)
238 return (priv->mdio_read(priv->ifp, phy, reg));
239
240 /*
241 * Try generic MII routine.
242 */
242 if (phy != priv->phy_id)
243 return (0);
244
243 KASSERT(phy == priv->phy_id,
244 ("read from phy %u but our phy is %u", phy, priv->phy_id));
245 return (cvm_oct_mdio_read(priv->ifp, phy, reg));
246}
247
248static int
249octe_miibus_writereg(device_t dev, int phy, int reg, int val)
250{
251 cvm_oct_private_t *priv;
252

--- 270 unchanged lines hidden ---
245 return (cvm_oct_mdio_read(priv->ifp, phy, reg));
246}
247
248static int
249octe_miibus_writereg(device_t dev, int phy, int reg, int val)
250{
251 cvm_oct_private_t *priv;
252

--- 270 unchanged lines hidden ---