superio driver

Constantine A. Murenin cnst++ at freebsd.org
Thu Nov 3 22:30:17 UTC 2016


On 3 November 2016 at 05:16, Andriy Gapon <avg at freebsd.org> wrote:
> On 17/10/2016 11:19, Andriy Gapon wrote:
>>
>> I would like to add a driver for Super I/O chips:
>> https://reviews.freebsd.org/D8175
>> In the review request you can find my rationale and description for the driver
>> as well as some question about its design.
>> At this point I am looking mostly for some help with the design, but any reviews
>> of the current code are also appreciated.
>
> Still looking for comments and suggestions.
> Thanks!

I think it's an interesting idea; I've had it a few years ago in the
context of OpenBSD, but didn't pursue it further due to a lack of much
uniformity around the Super I/O chips from different vendors.

LPC Super I/O chips from Winbond/Nuvoton and ITE do use a separate ISA
port for its Hardware Monitor functionality (often 0x290/8), and the
exact port number itself is still best be discovered through the Super
I/O driver (0x2e/2).  On the other hand, the watchdog timer is
nonetheless usually implemented within the confines of the main Super
I/O logic itself (e.g., 0x2e/2).

    http://mail-index.netbsd.org/tech-kern/2010/02/17/msg007343.html
    http://mdoc.su/f110/wbwd.4

In the case of Winbond, as per above, it did result in two drivers
being there in {Net,Open,DragonFly}BSD, one for the Super I/O that
does the discovery (and which might potentially have support for the
watchdog functionality), and another for the Hardware Monitor (the
lm-compatible one, which can also attach directly on I2C in
{Net,Open}BSD):

    http://bxr.su/DragonFly/sys/dev/powermng/wbsio/wbsio.c

    http://mdoc.su/n,o,d/wbsio.4
    http://mdoc.su/n,o,d/lm.4

However, in the case of http://mdoc.su/o/viasio.4 and
http://mdoc.su/n/itesio.4, the logic of Super I/O and Hardware Monitor
may be stuffed together into a single driver, even though both
functions are still performed at separate IO ports (look for the
multiple bus_space_map(9) calls, in fact, viasio(4) has separate ports
not only for the Hardware Monitor function, but for the Watchdog Timer
as well, something which is unique to it and is not shared by ITE and
Winbond/Nuvoton chips; nonetheless, all of these ports are claimed by
a single driver):

    http://bxr.su/OpenBSD/sys/dev/isa/viasio.c#viasio_hm_init
    http://bxr.su/NetBSD/sys/dev/isa/itesio_isa.c#itesio_isa_attach

If support for all of these Super IO chips would be implemented in a
single driver, then FreeBSD might as well end up with its own version
of what the I2C bus scan is on OpenBSD:

    http://bxr.su/OpenBSD/sys/dev/i2c/i2c_scan.c#iic_probe_sensor

Which is not necessarily a bad thing, and, in fact, provides an I2C
discovery interface which is very similar to what the situation is on
the more well designed platforms compared to x86, e.g., those that
have a smart property-based discovery mechanism via Open Firmware.

However, realistically, I am not sure what will we gain in this case
of probing for all of these Super I/O chips from a single bus driver;
in fact, as you've already noticed yourself, even the probing
mechanisms are already different between ITE and Winbond/Nuvoton, so,
what exactly do we gain by having it all together in a new bus?

Cheers,
Constantine.SU.


More information about the freebsd-arch mailing list