Date: Sat, 30 Nov 2019 18:03:53 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355236 - stable/12/sys/dev/cxgbe Message-ID: <201911301803.xAUI3rSU077965@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Sat Nov 30 18:03:53 2019 New Revision: 355236 URL: https://svnweb.freebsd.org/changeset/base/355236 Log: MFC r354522: cxgbe(4): Query Vdd from the firmware if its last known value is 0. TVSENSE may not be ready by the time t4_fw_initialize returns and the firmware returns 0 if the driver asks for the Vdd before the sensor is ready. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/t4_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_main.c Sat Nov 30 17:57:37 2019 (r355235) +++ stable/12/sys/dev/cxgbe/t4_main.c Sat Nov 30 18:03:53 2019 (r355236) @@ -645,6 +645,7 @@ static int sysctl_fec(SYSCTL_HANDLER_ARGS); static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); +static int sysctl_vdd(SYSCTL_HANDLER_ARGS); static int sysctl_loadavg(SYSCTL_HANDLER_ARGS); static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); @@ -6018,8 +6019,8 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RD, sc, 0, sysctl_loadavg, "A", "microprocessor load averages (debug firmwares only)"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_vdd", CTLFLAG_RD, - &sc->params.core_vdd, 0, "core Vdd (in mV)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "core_vdd", CTLTYPE_INT | + CTLFLAG_RD, sc, 0, sysctl_vdd, "I", "core Vdd (in mV)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "local_cpus", CTLTYPE_STRING | CTLFLAG_RD, sc, LOCAL_CPUS, @@ -7150,6 +7151,31 @@ sysctl_temperature(SYSCTL_HANDLER_ARGS) rc = sysctl_handle_int(oidp, &t, 0, req); return (rc); +} + +static int +sysctl_vdd(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int rc; + uint32_t param, val; + + if (sc->params.core_vdd == 0) { + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, + "t4vdd"); + if (rc) + return (rc); + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_DIAG) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_DIAG_VDD); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + end_synchronized_op(sc, 0); + if (rc) + return (rc); + sc->params.core_vdd = val; + } + + return (sysctl_handle_int(oidp, &sc->params.core_vdd, 0, req)); } static int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911301803.xAUI3rSU077965>