Skip to content

Commit

Permalink
Deprecate FreeBSD 9.x and older, fix for clang
Browse files Browse the repository at this point in the history
- smbus_ios.c, README.md: Despite being a nostalgic and greatly
appreciating older FreeBSD, it's time to drop support for 9.x, 8.x, and
7.x.  However, those who are still on 9.x deserve respect, as PR 173541
still affects 10.x and newer even as of this writing.

- main.c: Use the format attribute to squelch warnings on clang due
to use of -Wformat=2 (-Wformat-nonliteral).  This should also continue
to work on gcc, hopefully.

- README.md: add support for 10.x, minor ordering and labelling fixups

- bsdhwmon.8.txt: rebuilt on 11.x (no content changes)
  • Loading branch information
koitsu committed Mar 5, 2018
1 parent 23d6885 commit 79f7d2c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 28 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bsdhwmon is developed with a very different mentality compared to other hardware

* Written with stability and production environments in mind
* Intended for use with server products (currently Supermicro, but can be extended to others that have proper SMBIOS identification data)
* Uses SMBus ([smb(4)](https://www.freebsd.org/cgi/man.cgi?query=smb&apropos=0&sektion=0&manpath=FreeBSD+9.3-stable&arch=default&format=html) driver) exclusively, significantly decreasing risks and CPU usage compared to classic LPC I/O
* Uses SMBus ([smb(4)](https://www.freebsd.org/cgi/man.cgi?query=smb&apropos=0&sektion=0&manpath=FreeBSD+11.1-stable&arch=default&format=html) driver) exclusively, significantly decreasing risks and CPU usage compared to classic LPC I/O
* Based primarily on documentation provided by motherboard/server vendors, combined with documentation from chipset manufacturers
* Identifies hardware via strict SMBIOS data matching; device "probing" is avoided to minimise false positives and thus risks
* Full tested on both i386 and amd64 systems across multiple versions of FreeBSD (legacy and present-day)
Expand All @@ -19,17 +19,17 @@ bsdhwmon is developed with a very different mentality compared to other hardware
At this time, only a subset of Supermicro hardware is supported. For an official list of supported hardware and models, please see the [doc/SUPPORTED](doc/SUPPORTED) file.

## Supported Operating Systems
* FreeBSD 8.x (stable/8)
* FreeBSD 9.x (stable/9)

## Unsupported/Untested Operating Systems
* FreeBSD 10.x (stable/10)
* FreeBSD 11.x (stable/11)
* FreeBSD 10.x (stable/10)

## Untested Operating Systems
* FreeBSD 12.x (head/current)

## Deprecated Operating Systems
* FreeBSD 6.x (stable/6)
* FreeBSD 7.x (stable/7)
## Deprecated (Unsupported) Operating Systems
* FreeBSD 9.x
* FreeBSD 8.x
* FreeBSD 7.x
* FreeBSD 6.x

## Usage
Please see the [bsdhwmon man page](bsdhwmon.8.txt) for all command-line flags and usage details.
Expand Down
2 changes: 1 addition & 1 deletion bsdhwmon.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ CONTRIBUTORS
lm_sensors project, for providing an unofficial secondary source of IC
documentation and details of chip quirks.

FreeBSD 9.3 January 1, 2018 FreeBSD 9.3
FreeBSD 11.1 January 1, 2018 FreeBSD 11.1
5 changes: 5 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ static int f_verbose = 0; /* Command line flag "-v" */
* VERBOSE() is mainly used for debugging. Use of the "-v" flag will
* cause underlying functions to call VERBOSE() with all sorts of
* information.
*
* The format attribute is to safely squelch -Wformat-nonliteral (part
* of of -Wformat=2) warnings about vprintf() with clang. Reference:
* http://clang.llvm.org/docs/AttributeReference.html#format-gnu-format
*/
__attribute__((__format__ (__printf__, 1, 0)))
void
VERBOSE(const char *fmt, ...)
{
Expand Down
20 changes: 2 additions & 18 deletions smbus_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@
*
* http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html
*
* In __FreeBSD_version 702101 (2009/05/15), the smb(4) driver was
* modified to require SMBus slave addresses not have LSB (bit 0)
* set. This is per SMBus 2.0 specification, which clearly states that
* slave addreses are 7 bits in width and occupy the upper 7 bits of
* and 8-bit address (i.e. LSB is always 0). If the LSB is 1, the
* driver immediately returns EINVAL, resulting in ioctl(2) returning
* -1 with errno EINVAL. Commit:
*
* https://svnweb.freebsd.org/base?view=revision&revision=192149
*
* In __FreeBSD_version 1100070 (2015/04/25), the smb(4) driver smbcmd
* struct was overhauled, and backwards-compatibility appears to have
* been "lost" in favour of a different design. Discussion/commit:
Expand Down Expand Up @@ -71,11 +61,8 @@ read_byte(int fd, int slave, const char idxreg)
c.slave = slave << 1;
c.rbuf = ibuf;
c.rcount = 1;
#elif (__FreeBSD_version >= 702101)
c.slave = (u_char) (slave & 0xff) << 1;
c.data.byte_ptr = ibuf;
#else
c.slave = (u_char) slave & 0xff;
c.slave = (u_char) (slave & 0xff) << 1;
c.data.byte_ptr = ibuf;
#endif

Expand Down Expand Up @@ -114,11 +101,8 @@ write_byte(int fd, int slave, const char idxreg, const char value)
#if (__FreeBSD_version >= 1100070)
c.slave = slave << 1;
c.wdata.byte = value;
#elif (__FreeBSD_version >= 702101)
c.slave = (u_char) (slave & 0xff) << 1;
c.data.byte = value;
#else
c.slave = (u_char) slave & 0xff;
c.slave = (u_char) (slave & 0xff) << 1;
c.data.byte = value;
#endif

Expand Down

0 comments on commit 79f7d2c

Please sign in to comment.