Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci To avoid releasing mutex temporally, use new wm_...
details: https://anonhg.NetBSD.org/src/rev/98c7d7e678fe
branches: trunk
changeset: 368853:98c7d7e678fe
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Aug 08 08:55:42 2022 +0000
description:
To avoid releasing mutex temporally, use new wm_set_mdio_slow_mode_hv_locked().
diffstat:
sys/dev/pci/if_wm.c | 38 +++++++++++++++++++++++++++++---------
1 files changed, 29 insertions(+), 9 deletions(-)
diffs (78 lines):
diff -r 7e18a053d4f7 -r 98c7d7e678fe sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Mon Aug 08 08:52:36 2022 +0000
+++ b/sys/dev/pci/if_wm.c Mon Aug 08 08:55:42 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.756 2022/08/08 08:52:36 msaitoh Exp $ */
+/* $NetBSD: if_wm.c,v 1.757 2022/08/08 08:55:42 msaitoh Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.756 2022/08/08 08:52:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.757 2022/08/08 08:55:42 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -1119,6 +1119,7 @@
static int wm_k1_workaround_lv(struct wm_softc *);
static int wm_link_stall_workaround_hv(struct wm_softc *);
static int wm_set_mdio_slow_mode_hv(struct wm_softc *);
+static int wm_set_mdio_slow_mode_hv_locked(struct wm_softc *);
static void wm_configure_k1_ich8lan(struct wm_softc *, int);
static void wm_reset_init_script_82575(struct wm_softc *);
static void wm_reset_mdicnfg_82580(struct wm_softc *);
@@ -17136,13 +17137,32 @@
wm_set_mdio_slow_mode_hv(struct wm_softc *sc)
{
int rv;
+
+ rv = sc->phy.acquire(sc);
+ if (rv != 0) {
+ device_printf(sc->sc_dev, "%s: failed to get semaphore\n",
+ __func__);
+ return rv;
+ }
+
+ rv = wm_set_mdio_slow_mode_hv_locked(sc);
+
+ sc->phy.release(sc);
+
+ return rv;
+}
+
+static int
+wm_set_mdio_slow_mode_hv_locked(struct wm_softc *sc)
+{
+ int rv;
uint16_t reg;
- rv = wm_gmii_hv_readreg(sc->sc_dev, 1, HV_KMRN_MODE_CTRL, ®);
+ rv = wm_gmii_hv_readreg_locked(sc->sc_dev, 1, HV_KMRN_MODE_CTRL, ®);
if (rv != 0)
return rv;
- return wm_gmii_hv_writereg(sc->sc_dev, 1, HV_KMRN_MODE_CTRL,
+ return wm_gmii_hv_writereg_locked(sc->sc_dev, 1, HV_KMRN_MODE_CTRL,
reg | HV_KMRN_MDIO_SLOW);
}
@@ -17290,11 +17310,11 @@
*/
rv = 0;
if (sc->sc_type < WM_T_PCH_LPT) {
- sc->phy.release(sc);
- wm_set_mdio_slow_mode_hv(sc);
- rv = wm_gmii_hv_readreg(sc->sc_dev, 2, MII_PHYIDR1, &id1);
- rv |= wm_gmii_hv_readreg(sc->sc_dev, 2, MII_PHYIDR2, &id2);
- sc->phy.acquire(sc);
+ wm_set_mdio_slow_mode_hv_locked(sc);
+ rv = wm_gmii_hv_readreg_locked(sc->sc_dev, 2, MII_PHYIDR1,
+ &id1);
+ rv |= wm_gmii_hv_readreg_locked(sc->sc_dev, 2, MII_PHYIDR2,
+ &id2);
}
if ((rv != 0) || MII_INVALIDID(id1) || MII_INVALIDID(id2)) {
device_printf(sc->sc_dev, "XXX return with false\n");
Home |
Main Index |
Thread Index |
Old Index