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 213346 2010-10-02 05:43:17Z 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 /* 228 * Try interface-specific MII routine. 229 */ 230 if (priv->mdio_read != NULL) 231 return (priv->mdio_read(priv->ifp, phy, reg)); 232 233 /* 234 * Try generic MII routine. 235 */ |
236 if (phy != priv->phy_id) 237 return (0); 238 239 return (cvm_oct_mdio_read(priv->ifp, phy, reg)); 240} 241 242static int 243octe_miibus_writereg(device_t dev, int phy, int reg, int val) 244{ 245 cvm_oct_private_t *priv; 246 247 priv = device_get_softc(dev); 248 |
249 /* 250 * Try interface-specific MII routine. 251 */ 252 if (priv->mdio_write != NULL) { 253 priv->mdio_write(priv->ifp, phy, reg, val); 254 return (0); 255 } 256 257 /* 258 * Try generic MII routine. 259 */ |
260 KASSERT(phy == priv->phy_id, 261 ("write to phy %u but our phy is %u", phy, priv->phy_id)); |
262 cvm_oct_mdio_write(priv->ifp, phy, reg, val); 263 264 return (0); 265} 266 267static void 268octe_init(void *arg) 269{ --- 247 unchanged lines hidden --- |