From owner-svn-src-stable-12@freebsd.org Sat Nov 30 18:03:53 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B73611B25D8; Sat, 30 Nov 2019 18:03:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QK4n4SQZz4JGN; Sat, 30 Nov 2019 18:03:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D8F5216A; Sat, 30 Nov 2019 18:03:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAUI3r9G077966; Sat, 30 Nov 2019 18:03:53 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAUI3rSU077965; Sat, 30 Nov 2019 18:03:53 GMT (envelope-from np@FreeBSD.org) Message-Id: <201911301803.xAUI3rSU077965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 30 Nov 2019 18:03:53 +0000 (UTC) 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 X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe X-SVN-Commit-Revision: 355236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Nov 2019 18:03:53 -0000 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