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 213156 2010-09-25 04:39:12Z jmallett $
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?
--- 184 unchanged lines hidden (view full) ---
219
220static int
221octe_miibus_readreg(device_t dev, int phy, int reg)
222{
223 cvm_oct_private_t *priv;
224
225 priv = device_get_softc(dev);
226
227 if (phy != priv->phy_id)
228 return (0);
229
230 return (cvm_oct_mdio_read(priv->ifp, phy, reg));
231}
232
233static int
234octe_miibus_writereg(device_t dev, int phy, int reg, int val)
235{
236 cvm_oct_private_t *priv;
237
238 priv = device_get_softc(dev);
239
240 KASSERT(phy == priv->phy_id,
241 ("write to phy %u but our phy is %u", phy, priv->phy_id));
242
243 cvm_oct_mdio_write(priv->ifp, phy, reg, val);
244
245 return (0);
246}
247
248static void
249octe_init(void *arg)
250{
--- 247 unchanged lines hidden ---
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 213156 2010-09-25 04:39:12Z jmallett $
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?
--- 184 unchanged lines hidden (view full) ---
219
220static int
221octe_miibus_readreg(device_t dev, int phy, int reg)
222{
223 cvm_oct_private_t *priv;
224
225 priv = device_get_softc(dev);
226
227 if (phy != priv->phy_id)
228 return (0);
229
230 return (cvm_oct_mdio_read(priv->ifp, phy, reg));
231}
232
233static int
234octe_miibus_writereg(device_t dev, int phy, int reg, int val)
235{
236 cvm_oct_private_t *priv;
237
238 priv = device_get_softc(dev);
239
240 KASSERT(phy == priv->phy_id,
241 ("write to phy %u but our phy is %u", phy, priv->phy_id));
242
243 cvm_oct_mdio_write(priv->ifp, phy, reg, val);
244
245 return (0);
246}
247
248static void
249octe_init(void *arg)
250{
--- 247 unchanged lines hidden ---