ithwm: add ITE IT87xx SuperIO hardware monitor driver #6
Open
olivier
wants to merge 6 commits from
olivier/olivier-ithwm into main
AGit
pull from: olivier/olivier-ithwm
merge into: FreeBSD:main
FreeBSD:main
FreeBSD:stable/13
FreeBSD:stable/14
FreeBSD:stable/15
FreeBSD:releng/13.5
FreeBSD:releng/14.3
FreeBSD:releng/14.4
FreeBSD:releng/15.0
FreeBSD:vendor/openzfs/master
FreeBSD:HEAD
FreeBSD:vendor/Linux/rtw89
FreeBSD:vendor/Linux/rtw88
FreeBSD:vendor/Linux/mt76
FreeBSD:vendor/Linux/iwlwifi
FreeBSD:vendor/Linux/brcm80211
FreeBSD:vendor/Linux/ath12k
FreeBSD:vendor/Linux/ath11k
FreeBSD:vendor/Linux/ath10k
FreeBSD:vendor/Linux/ath-common
FreeBSD:vendor/libarchive
FreeBSD:vendor/zstd
FreeBSD:vendor/openssl-3.0
FreeBSD:vendor/openssl-3.5
FreeBSD:vendor/NetBSD/bmake
FreeBSD:vendor/openssh
FreeBSD:vendor/expat
FreeBSD:vendor/xz
FreeBSD:vendor/libfido2
FreeBSD:vendor/libcbor
FreeBSD:vendor/zlib
FreeBSD:vendor/NetBSD/libedit
FreeBSD:vendor/tzdata
FreeBSD:vendor/tzcode
FreeBSD:vendor/tcpdump
FreeBSD:vendor/less
FreeBSD:vendor/openzfs/zfs-2.4-release
FreeBSD:vendor/NetBSD/tests
FreeBSD:vendor/blocklist
FreeBSD:vendor/spleen
FreeBSD:vendor/nvi
FreeBSD:vendor/ncurses
FreeBSD:vendor/NetBSD/mtree
FreeBSD:vendor/llvm-project/release-21.x
FreeBSD:vendor/libucl
FreeBSD:vendor/libpcap
FreeBSD:vendor/acpica
FreeBSD:vendor/llvm-project/main
FreeBSD:vendor/sqlite3
FreeBSD:vendor/device-tree
FreeBSD:vendor/openzfs/zfs-2.2-release
FreeBSD:vendor/bsddialog
FreeBSD:vendor/unbound
FreeBSD:vendor/sendmail
FreeBSD:releng/14.2
FreeBSD:vendor/mandoc
FreeBSD:vendor/google/googletest
FreeBSD:vendor/bc
FreeBSD:vendor/lua
FreeBSD:vendor/krb5
FreeBSD:vendor/one-true-awk
FreeBSD:vendor/libsamplerate
FreeBSD:vendor/lyaml
FreeBSD:vendor/llvm-project/release-19.x
FreeBSD:vendor/libyaml
FreeBSD:vendor/openpam
FreeBSD:vendor/pam-krb5
FreeBSD:vendor/wireguard-tools
FreeBSD:vendor/edk2
FreeBSD:releng/13.4
FreeBSD:releng/14.1
FreeBSD:vendor/jemalloc
FreeBSD:vendor/arm-optimized-routines
FreeBSD:vendor/libder
FreeBSD:vendor/libecc
FreeBSD:stable/12
FreeBSD:vendor/file
FreeBSD:vendor/libcxxrt
FreeBSD:releng/13.3
FreeBSD:vendor/ena-com
FreeBSD:releng/14.0
FreeBSD:vendor/wpa
FreeBSD:releng/13.2
FreeBSD:vendor/byacc
FreeBSD:vendor/llvm-project/release-18.x
FreeBSD:vendor/netcat
FreeBSD:vendor/dhcpcd
FreeBSD:vendor/ntp
FreeBSD:vendor/ldns
FreeBSD:vendor/got/diff
FreeBSD:vendor/openzfs/zfs-2.1-release
FreeBSD:vendor/kyua
FreeBSD:releng/12.4
FreeBSD:releng/12.3
FreeBSD:vendor/llvm-project/release-17.x
FreeBSD:vendor/libevent
FreeBSD:vendor/pam_modules
FreeBSD:vendor/openssl-1.1.1
FreeBSD:stable/11
FreeBSD:vendor/unifdef
FreeBSD:vendor/NetBSD/libc-vis
FreeBSD:releng/13.1
FreeBSD:vendor/heimdal
FreeBSD:vendor/llvm-project/release-16.x
FreeBSD:vendor/opencsd
FreeBSD:vendor/openssl
FreeBSD:vendor/bearssl
FreeBSD:vendor/Juniper/libxo
FreeBSD:vendor/tcsh
FreeBSD:vendor/llvm-project/release-15.x
FreeBSD:stable/8
FreeBSD:vendor/google/capsicum-test
FreeBSD:releng/13.0
FreeBSD:vendor/bionic-x86_64-string
FreeBSD:vendor/xz-embedded
FreeBSD:vendor/llvm-project/release-14.x
FreeBSD:releng/12.2
FreeBSD:vendor/llvm-project/release-13.x
FreeBSD:vendor/terminus
FreeBSD:vendor/dma
FreeBSD:vendor/ck
FreeBSD:vendor/atf
FreeBSD:releng/11.4
FreeBSD:vendor/llvm-project/release-12.x
FreeBSD:vendor/NetBSD/vis
FreeBSD:stable/9
FreeBSD:stable/10
FreeBSD:vendor/openzfs/legacy
FreeBSD:vendor/dialog
FreeBSD:vendor/subversion
FreeBSD:releng/12.1
FreeBSD:vendor/llvm-project/release-11.x
FreeBSD:vendor/pnglite
FreeBSD:releng/11.3
FreeBSD:vendor/lib9p
FreeBSD:vendor/pcg-c
FreeBSD:vendor/llvm-project/master
FreeBSD:stable/7
FreeBSD:vendor/llvm-project/release-10.x
FreeBSD:vendor/flex
FreeBSD:vendor/apr
FreeBSD:vendor/bsnmp
FreeBSD:vendor/openbsm
FreeBSD:vendor/lutok
FreeBSD:releng/12.0
FreeBSD:vendor/llvm-project/release-9.x
FreeBSD:vendor/openssl-1.0.2
FreeBSD:vendor/llvm-project/release-8.x
FreeBSD:vendor/illumos
FreeBSD:vendor/openresolv
FreeBSD:vendor/NetBSD/blacklist
FreeBSD:vendor/llvm-openmp
FreeBSD:vendor/lldb
FreeBSD:vendor/lld
FreeBSD:vendor/llvm-libunwind
FreeBSD:vendor/libc++
FreeBSD:vendor/compiler-rt
FreeBSD:vendor/clang
FreeBSD:vendor/llvm
FreeBSD:releng/11.2
FreeBSD:vendor/lldb-90
FreeBSD:vendor/clang-90
FreeBSD:vendor/llvm-90
FreeBSD:vendor/lld-90
FreeBSD:vendor/libc++-90
FreeBSD:vendor/compiler-rt-90
FreeBSD:vendor/llvm-openmp-90
FreeBSD:vendor/llvm-libunwind-90
FreeBSD:vendor/bzip2
FreeBSD:vendor/llvm-libunwind-80
FreeBSD:vendor/clang-80
FreeBSD:vendor/llvm-openmp-80
FreeBSD:vendor/lldb-80
FreeBSD:vendor/lld-80
FreeBSD:vendor/elftoolchain
FreeBSD:vendor/libc++-80
FreeBSD:vendor/compiler-rt-80
FreeBSD:vendor/llvm-80
FreeBSD:vendor/libfdt
FreeBSD:vendor/clang-70
FreeBSD:vendor/libc++-70
FreeBSD:vendor/llvm-70
FreeBSD:vendor/lldb-70
FreeBSD:vendor/lld-70
FreeBSD:vendor/apr-util
FreeBSD:vendor/serf
FreeBSD:releng/10.4
FreeBSD:releng/11.1
FreeBSD:vendor/compiler-rt-70
FreeBSD:vendor/tzdb
FreeBSD:vendor/lldb-60
FreeBSD:vendor/lld-60
FreeBSD:vendor/libc++-60
FreeBSD:vendor/compiler-rt-60
FreeBSD:vendor/clang-60
FreeBSD:vendor/llvm-60
FreeBSD:releng/10.3
FreeBSD:vendor/dtc
FreeBSD:releng/11.0
FreeBSD:vendor/ctfdump
FreeBSD:vendor/pjdfstest
FreeBSD:vendor/heirloom-doctools
FreeBSD:releng/10.1
FreeBSD:releng/10.2
FreeBSD:releng/9.3
FreeBSD:vendor/bind9
FreeBSD:vendor/openssl-1.0.1
FreeBSD:vendor/alpine-hal
FreeBSD:vendor/cortex-strings
FreeBSD:vendor/amd
FreeBSD:vendor/libdivsufsort
FreeBSD:vendor/gcc
FreeBSD:vendor/ldns-host
FreeBSD:vendor/skein
FreeBSD:vendor/tnftp
FreeBSD:vendor/openssl-0.9.8
FreeBSD:stable/6
FreeBSD:vendor/pciids
FreeBSD:releng/8.4
FreeBSD:vendor/ficl
FreeBSD:releng/10.0
FreeBSD:vendor/gdb
FreeBSD:releng/9.2
FreeBSD:releng/9.1
FreeBSD:vendor/resolver
FreeBSD:stable/4
FreeBSD:releng/8.3
FreeBSD:vendor/bind9-9.8
FreeBSD:vendor/ipfilter
FreeBSD:vendor/ipfilter-sys
FreeBSD:vendor/NetBSD/libexecinfo
FreeBSD:vendor/misc-GNU/patch
FreeBSD:vendor/ipfilter-sys-old
FreeBSD:vendor/v4l
FreeBSD:vendor/hyperv
FreeBSD:vendor/libregex
FreeBSD:vendor/qcamain_open_hal
FreeBSD:releng/9.0
FreeBSD:vendor/NetBSD/unvis
FreeBSD:releng/7.4
FreeBSD:vendor/NetBSD/mknod
FreeBSD:vendor/bind9-9.6
FreeBSD:vendor/NetBSD/libc-pwcache
FreeBSD:releng/8.1
FreeBSD:releng/8.2
FreeBSD:vendor/groff
FreeBSD:vendor/opensolaris
FreeBSD:vendor/dtracetoolkit
FreeBSD:vendor/octeon-sdk
FreeBSD:vendor/NetBSD/softfloat
FreeBSD:releng/7.3
FreeBSD:vendor/gperf
FreeBSD:vendor/bind9-9.4
FreeBSD:vendor/com_err
FreeBSD:vendor/NetBSD/lukemftp
FreeBSD:vendor/tre
FreeBSD:vendor/gdtoa
FreeBSD:releng/7.1
FreeBSD:releng/8.0
FreeBSD:vendor/binutils
FreeBSD:vendor/ee
FreeBSD:releng/6.4
FreeBSD:releng/7.2
FreeBSD:vendor/misc-GNU/sort
FreeBSD:vendor/testfloat
FreeBSD:vendor/x86emu
FreeBSD:stable/5
FreeBSD:releng/6.3
FreeBSD:vendor/pf-sys
FreeBSD:vendor/pf
FreeBSD:vendor/top
FreeBSD:releng/7.0
FreeBSD:vendor/wpa_supplicant
FreeBSD:vendor/bind9-9.3
FreeBSD:vendor/libbegemot
FreeBSD:vendor/ath
FreeBSD:vendor/misc-GNU/cpio
FreeBSD:vendor/hostapd
FreeBSD:releng/5.5
FreeBSD:releng/6.1
FreeBSD:releng/6.2
FreeBSD:vendor/misc-GNU/cvs
FreeBSD:stable/3
FreeBSD:vendor/libreadline
FreeBSD:vendor/misc-GNU/diff
FreeBSD:vendor/ngatm
FreeBSD:vendor/csup
FreeBSD:releng/6.0
FreeBSD:releng/4.11
FreeBSD:vendor/pppd
FreeBSD:releng/5.3
FreeBSD:releng/5.4
FreeBSD:vendor/NetBSD/lukemftpd
FreeBSD:vendor/OpenBSD
FreeBSD:vendor/libuwx
FreeBSD:releng/4.10
FreeBSD:releng/4.8
FreeBSD:releng/4.9
FreeBSD:vendor/nve
FreeBSD:vendor/misc-GNU/texinfo
FreeBSD:vendor/NetBSD/misc
FreeBSD:releng/5.2
FreeBSD:releng/4.7
FreeBSD:releng/5.0
FreeBSD:releng/5.1
FreeBSD:vendor/isc-dhcp
FreeBSD:vendor/misc-GNU/grep
FreeBSD:vendor/altq
FreeBSD:vendor/SGI
FreeBSD:vendor/alsa
FreeBSD:vendor/bind
FreeBSD:releng/4.4
FreeBSD:releng/4.5
FreeBSD:releng/4.6
FreeBSD:releng/4.3
FreeBSD:vendor/ext2fs
FreeBSD:vendor/kerberosIV
FreeBSD:stable/2.2
FreeBSD:vendor/traceroute
FreeBSD:vendor/smbfs
FreeBSD:vendor/NetBSD/xlint
FreeBSD:vendor/NetBSD/sort
FreeBSD:vendor/opie
FreeBSD:vendor/perl5
FreeBSD:vendor/misc-GNU/bc
FreeBSD:vendor/lomac
FreeBSD:vendor/misc-GNU/awk
FreeBSD:vendor/tcp_wrappers
FreeBSD:vendor/libpam
FreeBSD:stable/2.1
FreeBSD:vendor/libgmp
FreeBSD:vendor/sym
FreeBSD:vendor/libdes
FreeBSD:vendor/ssleay
FreeBSD:vendor/misc-GNU/bison
FreeBSD:vendor/xe
FreeBSD:vendor/mrouted
FreeBSD:vendor/global
FreeBSD:vendor/CSRG
FreeBSD:vendor/softdep
FreeBSD:vendor/softupdates
FreeBSD:vendor/tcl
FreeBSD:vendor/voxware
FreeBSD:vendor/rarpd
FreeBSD:vendor/bind4
FreeBSD:vendor/stallion
FreeBSD:vendor/misc-GNU/misc
FreeBSD:vendor/ntpd
FreeBSD:vendor/rpcgen
FreeBSD:vendor/ncftp
FreeBSD:releng/2.0.5
FreeBSD:releng/2.0
FreeBSD:releng/1
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
FreeBSD/src!6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "olivier/olivier-ithwm"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add a new kernel driver for the hardware monitor logical device (LDN 4) of
ITE IT87xx SuperIO chips, tested on the IT8613.
The driver attaches as a child of the superio(4) bus and exposes temperatures,
fan speeds, and voltages via sysctl(8) under dev.ithwm.:
format, compatible with amdtemp(4) and lm75(4))
16-bit tachometer modes
Add a new kernel driver for the hardware monitor logical device (LDN 4) of ITE IT87xx SuperIO chips, tested on the IT8613. The driver attaches as a child of the superio(4) bus and exposes temperatures, fan speeds, and voltages via sysctl(8) under dev.ithwm.<unit>: - temp0..temp2: temperature sensors, reported in decikelvin ("IK" format, compatible with amdtemp(4) and lm75(4)) - fan0..fan2: fan speeds in RPM, supporting both 8-bit legacy and 16-bit tachometer modes - vin0..vin7, vbat: voltages in millivolts (1 LSB ~= 16 mV)Example on Aaostar WTR MAX:
- Remove unused sc->dev field from softc - Add mtx_assert(MA_OWNED) to ithwm_readb() to enforce its locking contract: callers must hold sc->lock before calling it - Replace dead runtime range checks in sysctl handlers with KASSERT; arg2 is a compile-time constant set by SYSCTL_ADD_PROC so EINVAL can never be returned in practice - Add missing bus_delete_resource() on the bus_alloc_resource_any() failure path in ithwm_attach() - Read ITHWM_REG_CFG directly via bus_write_1/bus_read_1 in attach instead of ithwm_readb() to avoid triggering the lock assertion (no concurrent access is possible during attach) - Fix detach/sysctl race: call sysctl_ctx_free() before mtx_destroy() and bus_release_resource() to drain any in-progress sysctl handler before tearing down hardware state - Remove dead io_res != NULL guard in detach (io_res is always set when detach is reached)@ -0,0 +3,4 @@** Copyright (c) 2024 Olivier Cochard** Redistribution and use in source and binary forms, with or withoutYou don't need anymore the full verbose text for the license if you have the SPDX header.
Overall looks fine. This is missing a man page.
@ -0,0 +156,4 @@* arg2 = 0..2 selects FAN1..FAN3.** 16-bit mode: count = (high << 8) | low; RPM = clock / count.* 8-bit mode: divisor from FANDIV; RPM = clock / (count * divisor).This doesn't need to be static.
@ -0,0 +164,4 @@{struct ithwm_softc *sc = arg1;int idx = arg2;uint16_t count;Why not define
rawto be a uint8_t?@markj wrote in #6 (comment):
(I have difficulties to match your comment to the correct line of code)
In ithwm_sysctl_vin((), Voltage is using a uint8_t for
rawbecause it can’t be negative, but in ithwm_sysctl_temp() couldn’t we get negative temperature ?Yeah, this comment is supposed to apply to ithwm_sysctl_temp(), looks like the line number tracking is a bit broken? (Or maybe I put the comment in the wrong place originally? I'm not sure.)
In any case, I see now, this looks ok.
You sent the command and later @olivier pushed a new version where he delete some lines. github suffers from the same issue.
@ -0,0 +196,4 @@rpm = 0;elserpm = ITHWM_FAN_CLOCK / ((unsigned int)lo * divisor);}These arrays don't need to be static.
Folks, why do I get notifications for this pull request?
@michaelo wrote in #6 (comment):
there's some backend fiddling going on to make notifications work properly, and by accident the entire src group received notifications for all src PRs. i think @bapt is working on this.
@ -0,0 +1,86 @@.\" SPDX-License-Identifier: BSD-2-Clause.\".\" Copyright (c) 2024 Olivier Cochard.\"style.9 and the licensing guide recommend a blank comment at the beginning for consistency with C comments, and placing the copyright line before the spdx line when using spdx only license declaration.
@ -0,0 +9,4 @@.Nm ithwm.Nd hardware monitor driver for ITE IT87xx Super I/O chips.Sh SYNOPSISTo compile this driver into the kernel, place the following lines in yourPlease consider using the format I proposed on arch@ and at BSDCan. We have almost 200 manuals in the tree using this format, and it is more consistent with the rest of BSD ecosystem.
@ziaee wrote in #6 (comment):
do you have a link ?
Sure, https://marc.info/?l=freebsd-arch&m=176782215606871
@ -0,0 +43,4 @@.Bl -bullet -compact.ItITE IT8613E.Elhow do we do code sugestions? I tried clicking and dragging the lines but no avail.
style.mdoc.7 recommends using a HARDWARE section for this, which gets pulled into the hardware release note, and declaring the type of supported device at the end of the introductory sentence because the entire hardware section appears on it's own with no other context.
manpage looks fine to me. don't forget to fix the license in the other files
Looks good!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.