Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src Pull up following revision(s) (requested by msaitoh in ti...



details:   https://anonhg.NetBSD.org/src/rev/1574bd79d918
branches:  netbsd-8
changeset: 851151:1574bd79d918
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Nov 22 14:56:30 2017 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #374):
        share/man/man4/lm.4: revision 1.33
        share/man/man4/lm.4: revision 1.34
        sys/dev/ic/nslm7x.c: revision 1.70
        sys/dev/isa/lm_isa_common.c: revision 1.5
        sys/dev/isa/lm_isa_common.c: revision 1.6
        sys/dev/isa/wbsio.c: revision 1.11
        sys/dev/i2c/lm_i2c.c: revision 1.3
        sys/dev/isa/wbsio.c: revision 1.12
        sys/dev/i2c/lm_i2c.c: revision 1.4
        sys/dev/isa/wbsioreg.h: revision 1.1
        sys/dev/isa/wbsio.c: revision 1.13
        sys/dev/isa/wbsioreg.h: revision 1.2
        sys/dev/isa/wbsio.c: revision 1.14
        sys/dev/isa/wbsioreg.h: revision 1.3
        sys/dev/isa/wbsio.c: revision 1.15
        sys/dev/isa/wbsioreg.h: revision 1.4
        sys/dev/isa/wbsioreg.h: revision 1.5
        share/man/man4/wbsio.4: revision 1.4
        share/man/man4/wbsio.4: revision 1.5
        sys/dev/ic/nslm7xvar.h: revision 1.30
        sys/dev/ic/nslm7x.c: revision 1.65
        share/man/man4/wbsio.4: revision 1.6
        sys/dev/ic/nslm7xvar.h: revision 1.31
        sys/dev/ic/nslm7x.c: revision 1.66
        sys/dev/ic/nslm7xvar.h: revision 1.32
        sys/dev/ic/nslm7x.c: revision 1.67
        sys/dev/ic/nslm7xvar.h: revision 1.33
        sys/dev/ic/nslm7x.c: revision 1.68
        sys/dev/ic/nslm7x.c: revision 1.69
  Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT610[246]D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.
lm(4): Add support for NCT5104D, NCT610[246]D, NCT6775F, NCT6779D and NCT679[1235]D.
wbsio(4): Add support for NCT6795D.
Add note about Nuvoton.
- Add new Nuvoton devices.
- Add CAVEATS section from OpenBSD.
Add space before left-paren
Remove superfluous Pp.
Whitespace.
  Fix a bug that fan RPM wasn't printed correctly. 0xbX is not RPM but counter.
Use 0xcX.
  Fix typo.
- Sprinkle static and const. No functional change.
- Print chip ID in hexadecimal instead of octal in def_match().
  Use uint8_t instead of int. No functional change.
  Print chip name correctly.
- WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
   from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
   the function to check strictly.
- NCT610[246]D is different from others, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
   from others. When it failed reading vendor ID or chip ID, fallback to
   NCT610[246]D's register offsets.
- Add debug messages.
  Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.
  s/Id/NetBSD/. Pointed out by wiz!

diffstat:

 share/man/man4/lm.4         |   27 +-
 share/man/man4/wbsio.4      |    9 +-
 sys/dev/i2c/lm_i2c.c        |   10 +-
 sys/dev/ic/nslm7x.c         |  832 ++++++++++++++++++++++++++++++++++++-------
 sys/dev/ic/nslm7xvar.h      |   24 +-
 sys/dev/isa/lm_isa_common.c |   13 +-
 sys/dev/isa/wbsio.c         |  210 +++++-----
 sys/dev/isa/wbsioreg.h      |   67 +++
 8 files changed, 917 insertions(+), 275 deletions(-)

diffs (truncated from 1760 to 300 lines):

diff -r c466f60fd902 -r 1574bd79d918 share/man/man4/lm.4
--- a/share/man/man4/lm.4       Wed Nov 22 14:47:40 2017 +0000
+++ b/share/man/man4/lm.4       Wed Nov 22 14:56:30 2017 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: lm.4,v 1.32 2010/02/21 05:16:29 cnst Exp $
+.\"    $NetBSD: lm.4,v 1.32.40.1 2017/11/22 14:56:30 martin Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 16, 2010
+.Dd July 12, 2017
 .Dt LM 4
 .Os
 .Sh NAME
@@ -51,7 +51,7 @@
 .Xr envsys 4
 API.
 .Pp
-Most supported devices possess 11 sensors:
+The original LM78 hardware monitor supports 11 sensors:
 .Bl -column "Sensor" "Units" "Typical" -offset indent
 .It Sy "Sensor" Ta Sy "Units" Ta Sy "Typical Use"
 .It Li "IN0" Ta "uV DC" Ta "Core voltage"
@@ -66,8 +66,7 @@
 .It Li "Fan1" Ta "RPM" Ta "Chassis Fan"
 .It Li "Fan2" Ta "RPM" Ta "Fan"
 .El
-for some devices (most Winbond devices) sensor names and numbers will be
-different.
+For other devices, sensors' names and numbers will be different.
 .Pp
 Due to hardware limitations, fresh sensor data is only available every
 2 seconds.
@@ -75,7 +74,6 @@
 Chips supported by the
 .Nm
 driver include:
-.Pp
 .Bl -item -offset indent
 .It
 .Tn National Semiconductor
@@ -85,6 +83,19 @@
 and
 .Em LM81 .
 .It
+.Tn Nuvoton
+.Em NCT5104D ,
+.Em NCT6775F ,
+.Em NCT6776F ,
+.Em NCT6102D ,
+.Em NCT6104D ,
+.Em NCT6106D ,
+.Em NCT6779D ,
+.Em NCT6791D ,
+.Em NCT6792D ,
+.Em NCT6793D ,
+.Em NCT6795D .
+.It
 .Tn Winbond
 .Em W83627HF* ,
 .Em W83627THF* ,
@@ -124,6 +135,10 @@
 .Nm
 device appeared in
 .Nx 1.5 .
+.Sh CAVEATS
+Some vendors connect these chips to non-standard thermal diodes and
+resistors.
+This will result in bogus sensor values.
 .Sh BUGS
 Interrupt support is unimplemented.
 .Pp
diff -r c466f60fd902 -r 1574bd79d918 share/man/man4/wbsio.4
--- a/share/man/man4/wbsio.4    Wed Nov 22 14:47:40 2017 +0000
+++ b/share/man/man4/wbsio.4    Wed Nov 22 14:56:30 2017 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: wbsio.4,v 1.3 2014/03/18 18:20:39 riastradh Exp $
+.\"    $NetBSD: wbsio.4,v 1.3.18.1 2017/11/22 14:56:30 martin Exp $
 .\"    $OpenBSD: wbsio.4,v 1.2 2008/02/17 16:48:47 jmc Exp $
 .\"
 .\" Copyright (c) 2008 Mark Kettenis <kettenis%openbsd.org@localhost>
@@ -15,12 +15,12 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd February 16, 2010
+.Dd July 12, 2017
 .Dt WBSIO 4
 .Os
 .Sh NAME
 .Nm wbsio
-.Nd Winbond LPC Super I/O
+.Nd Winbond (Nuvoton) LPC Super I/O
 .Sh SYNOPSIS
 .Cd "wbsio* at isa? port 0x2e"
 .Cd "wbsio* at isa? port 0x4e"
@@ -28,7 +28,8 @@
 .Sh DESCRIPTION
 The
 .Nm
-driver provides support for the Winbond LPC Super I/O ICs.
+driver provides support for the Winbond (was spun off as Nuvoton) LPC Super I/O
+ICs.
 Only the hardware monitoring function is currently supported.
 .Pp
 Support for the hardware monitor function is provided through the
diff -r c466f60fd902 -r 1574bd79d918 sys/dev/i2c/lm_i2c.c
--- a/sys/dev/i2c/lm_i2c.c      Wed Nov 22 14:47:40 2017 +0000
+++ b/sys/dev/i2c/lm_i2c.c      Wed Nov 22 14:56:30 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lm_i2c.c,v 1.2 2008/10/13 11:16:00 pgoyette Exp $      */
+/*     $NetBSD: lm_i2c.c,v 1.2.80.1 2017/11/22 14:56:30 martin Exp $   */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lm_i2c.c,v 1.2 2008/10/13 11:16:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lm_i2c.c,v 1.2.80.1 2017/11/22 14:56:30 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -49,7 +49,7 @@
 int    lm_i2c_detach(device_t, int);
 
 uint8_t lm_i2c_readreg(struct lm_softc *, int);
-void   lm_i2c_writereg(struct lm_softc *, int, int);
+void   lm_i2c_writereg(struct lm_softc *, int, uint8_t);
 
 struct lm_i2c_softc {
        struct lm_softc sc_lmsc;
@@ -76,7 +76,7 @@
        sc.sc_lmsc.lm_readreg = lm_i2c_readreg;
        sc.sc_tag = ia->ia_tag;
        sc.sc_addr = ia->ia_addr;
-       rv = lm_probe(&sc.sc_lmsc);
+       rv = lm_match(&sc.sc_lmsc);
 
        return rv;
 }
@@ -127,7 +127,7 @@
 
 
 void
-lm_i2c_writereg(struct lm_softc *lmsc, int reg, int val)
+lm_i2c_writereg(struct lm_softc *lmsc, int reg, uint8_t val)
 {
        struct lm_i2c_softc *sc = (struct lm_i2c_softc *)lmsc;
        uint8_t cmd, data;
diff -r c466f60fd902 -r 1574bd79d918 sys/dev/ic/nslm7x.c
--- a/sys/dev/ic/nslm7x.c       Wed Nov 22 14:47:40 2017 +0000
+++ b/sys/dev/ic/nslm7x.c       Wed Nov 22 14:56:30 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nslm7x.c,v 1.64 2016/06/01 08:06:38 pgoyette Exp $ */
+/*     $NetBSD: nslm7x.c,v 1.64.10.1 2017/11/22 14:56:30 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.64 2016/06/01 08:06:38 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.64.10.1 2017/11/22 14:56:30 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -45,6 +45,7 @@
 
 #include <dev/isa/isareg.h>
 #include <dev/isa/isavar.h>
+#include <dev/isa/wbsioreg.h>
 
 #include <dev/sysmon/sysmonvar.h>
 
@@ -71,15 +72,21 @@
 
 #define LM_REFRESH_TIMO        (2 * hz)        /* 2 seconds */
 
-static int lm_match(struct lm_softc *);
+static const struct wb_product *wb_lookup(struct lm_softc *,
+    const struct wb_product *, uint16_t);
 static int wb_match(struct lm_softc *);
+static int wb_attach(struct lm_softc *);
+static int nslm_match(struct lm_softc *);
+static int nslm_attach(struct lm_softc *);
 static int def_match(struct lm_softc *);
+static int def_attach(struct lm_softc *);
 static void wb_temp_diode_type(struct lm_softc *, int);
+static uint16_t wb_read_vendorid(struct lm_softc *);
 
 static void lm_refresh(void *);
 
-static void lm_generic_banksel(struct lm_softc *, int);
-static void lm_setup_sensors(struct lm_softc *, struct lm_sensor *);
+static void lm_generic_banksel(struct lm_softc *, uint8_t);
+static void lm_setup_sensors(struct lm_softc *, const struct lm_sensor *);
 static void lm_refresh_sensor_data(struct lm_softc *);
 static void lm_refresh_volt(struct lm_softc *, int);
 static void lm_refresh_temp(struct lm_softc *, int);
@@ -93,20 +100,22 @@
 static void wb_refresh_fanrpm(struct lm_softc *, int);
 static void wb_w83792d_refresh_fanrpm(struct lm_softc *, int);
 static void wb_nct6776f_refresh_fanrpm(struct lm_softc *, int);
+
 static void as_refresh_temp(struct lm_softc *, int);
 
 struct lm_chip {
        int (*chip_match)(struct lm_softc *);
+       int (*chip_attach)(struct lm_softc *);
 };
 
 static struct lm_chip lm_chips[] = {
-       { wb_match },
-       { lm_match },
-       { def_match } /* Must be last */
+       { wb_match,     wb_attach },
+       { nslm_match,   nslm_attach },
+       { def_match,    def_attach } /* Must be last */
 };
 
 /* LM78/78J/79/81 */
-static struct lm_sensor lm78_sensors[] = {
+static const struct lm_sensor lm78_sensors[] = {
        /* Voltage */
        {
                .desc = "VCore A",
@@ -205,7 +214,7 @@
 };
 
 /* W83627HF */
-static struct lm_sensor w83627hf_sensors[] = {
+static const struct lm_sensor w83627hf_sensors[] = {
        /* Voltage */
        {
                .desc = "VCore A",
@@ -344,7 +353,7 @@
  * need special treatment, also because the reference voltage is 2.048 V
  * instead of the traditional 3.6 V.
  */
-static struct lm_sensor w83627ehf_sensors[] = {
+static const struct lm_sensor w83627ehf_sensors[] = {
        /* Voltage */
        {
                .desc = "VCore",
@@ -483,7 +492,7 @@
 };
 
 /*  W83627DHG */
-static struct lm_sensor w83627dhg_sensors[] = {
+static const struct lm_sensor w83627dhg_sensors[] = {
        /* Voltage */
        {
                .desc = "VCore",
@@ -614,7 +623,7 @@
 };
 
 /* W83637HF */
-static struct lm_sensor w83637hf_sensors[] = {
+static const struct lm_sensor w83637hf_sensors[] = {
        /* Voltage */
        {
                .desc = "VCore",
@@ -729,7 +738,7 @@
 };
 
 /* W83697HF */
-static struct lm_sensor w83697hf_sensors[] = {
+static const struct lm_sensor w83697hf_sensors[] = {
        /* Voltage */
        {
                .desc = "VCore",
@@ -842,7 +851,7 @@
  * +5V, but using the values from the W83782D datasheets seems to
  * provide sensible results.
  */
-static struct lm_sensor w83781d_sensors[] = {
+static const struct lm_sensor w83781d_sensors[] = {
        /* Voltage */
        {
                .desc = "VCore A",
@@ -957,7 +966,7 @@
 };
 
 /* W83782D */
-static struct lm_sensor w83782d_sensors[] = {
+static const struct lm_sensor w83782d_sensors[] = {
        /* Voltage */
        {
                .desc = "VCore",
@@ -1088,7 +1097,7 @@
 };
 
 /* W83783S */



Home | Main Index | Thread Index | Old Index