Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jun 2014 14:21:49 +0200 (CEST)
From:      Emeric POUPON <emeric.poupon@arkoon-netasq.com>
To:        freebsd-arch@freebsd.org
Subject:   How to properly handle several fonctions provided by the Winbond SuperIO chip?
Message-ID:  <1118241087.138096.1403180509132.JavaMail.zimbra@arkoon-netasq.com>
In-Reply-To: <961817567.135121.1403178816482.JavaMail.zimbra@arkoon-netasq.com>

index | next in thread | previous in thread | raw e-mail

Hello,

I have a design question about how to configure/control a Winbond Super IO device.

Currently, only the Watchdog feature is properly handled in FreeBSD (see dev/wbwd), but I would like to control the GPIO that are managed by this SuperIO device.

Making a complete separate isa driver seems not to be a good idea :
- duplicated probe/attach routines.
- concurrency accesses on the registers. Indeed this device provides an "extended mode" in order to be configured, and it also provides a "logical device" selection in order to access specific features (one logical device for the watchdog, another one for a GPIO port, etc.).

As far as I understand, they solved the problem on Linux by :
- using separate drivers
- using a memory locked mechanism when entering/exiting the extended mode.

However, on FreeBSD I would split the whole thing in three drivers:
- wbsio (sio stands for SuperIO), the main driver:
  - identify/attach/probe routines on the isa bus.
  - provide primitives to enter/exit the extended mode, and hangle an internal mutex to give exclusive access on this mode.
  - provide primitives to select the logical device and read/write the internal registers
  - attach child devices "wbwd" and "gpio".
- wbwd, 
  - child of wbsio
  - register the watchdog event callback
  - use wbsio primitives to get the work done
- wbgpio,
  - child of wbsio
  - implement gpio methods
  - add child devices "gpioc" and "gpiobus"
  - use wbsio primitives to get the work done

What do you think? Is that the good way to proceed?

Regards,

Emeric POUPON


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1118241087.138096.1403180509132.JavaMail.zimbra>