From owner-freebsd-arch@FreeBSD.ORG Thu Jun 19 12:21:59 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32806837 for ; Thu, 19 Jun 2014 12:21:59 +0000 (UTC) Received: from work.netasq.com (gwlille.netasq.com [91.212.116.1]) by mx1.freebsd.org (Postfix) with ESMTP id EB1D4297F for ; Thu, 19 Jun 2014 12:21:57 +0000 (UTC) Received: from work.netasq.com (localhost [127.0.0.1]) by work.netasq.com (Postfix) with ESMTP id 8A7E02703BF1 for ; Thu, 19 Jun 2014 14:21:49 +0200 (CEST) Received: from work.netasq.com (localhost [127.0.0.1]) by work.netasq.com (Postfix) with ESMTP id 72F1A2703BEC for ; Thu, 19 Jun 2014 14:21:49 +0200 (CEST) Date: Thu, 19 Jun 2014 14:21:49 +0200 (CEST) From: Emeric POUPON To: freebsd-arch@freebsd.org Message-ID: <1118241087.138096.1403180509132.JavaMail.zimbra@arkoon-netasq.com> In-Reply-To: <961817567.135121.1403178816482.JavaMail.zimbra@arkoon-netasq.com> Subject: How to properly handle several fonctions provided by the Winbond SuperIO chip? MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Thread-Topic: How to properly handle several fonctions provided by the Winbond SuperIO chip? Thread-Index: wf/3trm5wPfPwflEhpkBu4Rgz0DguA== X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jun 2014 12:21:59 -0000 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