Module Name: src
Committed By: mrg
Date: Fri Apr 24 09:29:26 UTC 2020
Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c octeon_gmx.c octeon_gmxvar.h
Log Message:
fetch properties in attach rather than every re-init.
this avoids a rwlock while spinlock held problem likely introduced
with MII locking rework, as fetching a property takes an rwlock,
and prior to the rework, only kernel lock would have been held.
ok skrll@.
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/cavium/dev/if_cnmac.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_gmx.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_gmxvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.17 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.18
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.17 Tue Feb 18 15:00:42 2020
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c Fri Apr 24 09:29:26 2020
@@ -1,8 +1,8 @@
-/* $NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $ */
+/* $NetBSD: if_cnmac.c,v 1.18 2020/04/24 09:29:26 mrg Exp $ */
#include <sys/cdefs.h>
#if 0
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.18 2020/04/24 09:29:26 mrg Exp $");
#endif
#include "opt_octeon.h"
@@ -292,6 +292,8 @@ octeon_eth_attach(device_t parent, devic
struct octeon_eth_softc *sc = device_private(self);
struct octeon_gmx_attach_args *ga = aux;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+ prop_dictionary_t dict;
+ prop_object_t clk;
uint8_t enaddr[ETHER_ADDR_LEN];
sc->sc_dev = self;
@@ -399,6 +401,15 @@ octeon_eth_attach(device_t parent, devic
OCTEON_EVCNT_ATTACH_EVCNTS(sc, octeon_evcnt_entries,
device_xname(sc->sc_dev));
+
+ dict = device_properties(sc->sc_gmx->sc_dev);
+
+ clk = prop_dictionary_get(dict, "rgmii-tx");
+ KASSERT(clk != NULL);
+ sc->sc_gmx_port->sc_clk_tx_setting = prop_number_integer_value(clk);
+ clk = prop_dictionary_get(dict, "rgmii-rx");
+ KASSERT(clk != NULL);
+ sc->sc_gmx_port->sc_clk_rx_setting = prop_number_integer_value(clk);
}
/* ---- submodules */
Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.8 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.9
--- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.8 Wed Jan 29 05:30:14 2020
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c Fri Apr 24 09:29:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $ */
+/* $NetBSD: octeon_gmx.c,v 1.9 2020/04/24 09:29:26 mrg Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.9 2020/04/24 09:29:26 mrg Exp $");
#include "opt_octeon.h"
@@ -847,9 +847,6 @@ octeon_gmx_rgmii_speed_speed(struct octe
static int
octeon_gmx_rgmii_timing(struct octeon_gmx_port_softc *sc)
{
- prop_dictionary_t dict = device_properties(sc->sc_port_gmx->sc_dev);
- prop_object_t clk;
- int clk_tx_setting, clk_rx_setting;
uint64_t rx_frm_ctl;
/* RGMII TX Threshold Registers
@@ -887,14 +884,9 @@ octeon_gmx_rgmii_timing(struct octeon_gm
/* RGMII TX Clock-Delay Registers
* Delay setting to place n TXC (RGMII transmit clock) delay line.
*/
- clk = prop_dictionary_get(dict, "rgmii-tx");
- KASSERT(clk != NULL);
- clk_tx_setting = prop_number_integer_value(clk);
- clk = prop_dictionary_get(dict, "rgmii-rx");
- KASSERT(clk != NULL);
- clk_rx_setting = prop_number_integer_value(clk);
- octeon_asx_clk_set(sc->sc_port_asx, clk_tx_setting, clk_rx_setting);
+ octeon_asx_clk_set(sc->sc_port_asx,
+ sc->sc_clk_tx_setting, sc->sc_clk_rx_setting);
return 0;
}
Index: src/sys/arch/mips/cavium/dev/octeon_gmxvar.h
diff -u src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.2 src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.3
--- src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.2 Thu Apr 19 21:50:06 2018
+++ src/sys/arch/mips/cavium/dev/octeon_gmxvar.h Fri Apr 24 09:29:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_gmxvar.h,v 1.2 2018/04/19 21:50:06 christos Exp $ */
+/* $NetBSD: octeon_gmxvar.h,v 1.3 2020/04/24 09:29:26 mrg Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -69,6 +69,9 @@ struct octeon_gmx_port_softc {
struct octeon_ipd_softc *sc_ipd;
int sc_port_flowflags;
+ int sc_clk_tx_setting;
+ int sc_clk_rx_setting;
+
#if defined(OCTEON_DEBUG) || defined(OCTEON_ETH_DEBUG)
#if 0
/* XXX */