From owner-freebsd-arch@freebsd.org Thu Nov 3 22:30:17 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 627B0C2D223 for ; Thu, 3 Nov 2016 22:30:17 +0000 (UTC) (envelope-from mureninc@gmail.com) Received: from mail-vk0-x22f.google.com (mail-vk0-x22f.google.com [IPv6:2607:f8b0:400c:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 25C501729; Thu, 3 Nov 2016 22:30:17 +0000 (UTC) (envelope-from mureninc@gmail.com) Received: by mail-vk0-x22f.google.com with SMTP id p9so52625848vkd.3; Thu, 03 Nov 2016 15:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=jHRXpqUkKlTiHcXpg6AxEVh5saKLnPU4LzjlEsD7Ccc=; b=Il8kF/ZqKty6gBsfZohv4u3WUYfEbD+iLRw2g+Gs43QyTKklQVXlu2JtYddlrrcBts uOk2LlYgPiflw51LZ6zhusRAUi+/NHvOT33SNvyBtmyTVWDtbIpJP0VGnJKekPlTTEZF SwJzjpqHS5JosJjT/nLQitr8GNsf1TP8P4xQds8ghvdRTYgSEJYZVOxiMAzAe+/2tT5G /g42sEaFcdF4bkEme8EfwQuzAcnfI+xGhAInuZ/z7RyynzRB9mmadrpjtShDVmD6swyy j+g2QsemIOcztEMwe/GMZUsz/r3VnIuxe/KPIFPK1aXcUnjGxa0x+HPnUjcuOMPwoA1G gzcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=jHRXpqUkKlTiHcXpg6AxEVh5saKLnPU4LzjlEsD7Ccc=; b=aj+H8N2VajtYO5QkVxXhPFEacHROUbHJ5QCgVxTzRp0Vqw0PoQalWApRLWo6lxb1Mt bn4RDnsG/gL+Y/4J/kBIBxCyPw+vSuR4RwBzgywM1pCkB89PClazwQ8mLRES3GSF/DDm xuSg0vm74gnyRTCe38of3BtMDgyL17n0odOH9AH/mRP1grmGxHx0pJCl9Xe51lKrvRdE m8pkO5g7hbwzQBCH6Pi9eD/MyUp4MtOsipn6OODws2GHmMdYP1KSowIY9ZQYTox/BvbR O2fqF2kN4S478i1VdFJbyLxo/kmhWhyiz6lAQA7gzahzZghHgCBCYbxakOjT7PcsgP6V Gohg== X-Gm-Message-State: ABUngvdWSoKoPyzqxM6KukRic01EqsJmDfNAJH4TWRkpsS8M2MvFXgOTm42ino10V0WdvURYVunHtoiFBEGvmA== X-Received: by 10.31.229.133 with SMTP id c127mr9504930vkh.153.1478212215992; Thu, 03 Nov 2016 15:30:15 -0700 (PDT) MIME-Version: 1.0 Sender: mureninc@gmail.com Received: by 10.176.1.147 with HTTP; Thu, 3 Nov 2016 15:30:15 -0700 (PDT) In-Reply-To: <0d588744-c83f-1f04-3c79-89cba63949a3@FreeBSD.org> References: <0d588744-c83f-1f04-3c79-89cba63949a3@FreeBSD.org> From: "Constantine A. Murenin" Date: Thu, 3 Nov 2016 17:30:15 -0500 X-Google-Sender-Auth: 2PIcmBCEiHj5jpRI8-K8fUno-dc Message-ID: Subject: Re: superio driver To: Andriy Gapon Cc: "freebsd-arch@freebsd.org" , "Constantine A. Murenin" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 22:30:17 -0000 On 3 November 2016 at 05:16, Andriy Gapon 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.