Date: Fri, 2 Aug 2013 18:05:42 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253890 - head/sys/dev/cxgbe Message-ID: <201308021805.r72I5grG021841@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Fri Aug 2 18:05:42 2013 New Revision: 253890 URL: http://svnweb.freebsd.org/changeset/base/253890 Log: Display temperature sensor data. Shows -1 if sensor not available on the card. # sysctl dev.t4nex.0.temperature # sysctl dev.t5nex.0.temperature Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Aug 2 17:44:19 2013 (r253889) +++ head/sys/dev/cxgbe/t4_main.c Fri Aug 2 18:05:42 2013 (r253890) @@ -379,6 +379,7 @@ static int sysctl_holdoff_pktc_idx(SYSCT static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS); static int sysctl_qsize_txq(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); +static int sysctl_temperature(SYSCTL_HANDLER_ARGS); #ifdef SBUF_DRAIN static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); @@ -4223,6 +4224,10 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nfilters", CTLFLAG_RD, NULL, sc->tids.nftids, "number of filters"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "temperature", CTLTYPE_INT | + CTLFLAG_RD, sc, 0, sysctl_temperature, "A", + "chip temperature (in Celsius)"); + t4_sge_sysctls(sc, ctx, children); #ifdef SBUF_DRAIN @@ -4865,6 +4870,31 @@ sysctl_handle_t4_reg64(SYSCTL_HANDLER_AR return (sysctl_handle_64(oidp, &val, 0, req)); } +static int +sysctl_temperature(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int rc, t; + uint32_t param, val; + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4temp"); + 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_TMP); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + end_synchronized_op(sc, 0); + if (rc) + return (rc); + + /* unknown is returned as 0 but we display -1 in that case */ + t = val == 0 ? -1 : val; + + rc = sysctl_handle_int(oidp, &t, 0, req); + return (rc); +} + #ifdef SBUF_DRAIN static int sysctl_cctrl(SYSCTL_HANDLER_ARGS)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308021805.r72I5grG021841>