From owner-freebsd-current@freebsd.org Wed Dec 19 20:01:47 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8E20134290A for ; Wed, 19 Dec 2018 20:01:47 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F42B6B172 for ; Wed, 19 Dec 2018 20:01:46 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1545249668; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=oyRzwZdAUtCcYRp8u92G0uKzUpyQABMX+fBUWKUJInsY09w2cJgXTZGod2atPRVzkwA8HXzR/LE/Z 29iA08xmVUQVIxqwDAv2NRh/xQGRTPlIovQV4WthGmbJxjyboP3OVzdAvtK5aThcP5ZotGhk3EBF2L xV0vRzaKL+NpRWdJweRegB+8eqb1NLT0CVWIpgaXvLBUHs7Nz7x9UKDEtq32IneXq0JEuQT9zfY+Nm onwSlMG8zsSfaAX+lfb8iQxFG2nVy9ERIXaGM46ajAjBYUkwrJ7uAmt5lACgZggMjqvqcbu5smiT15 o24uEf9E105gmeB1TIzEJEyN+U6nPVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=JOYJ06taVcvo7lkh53LM4DKiwj8s8qjlt9+HZc4Ado0=; b=IRXO9DgY59zgfLYCT40Dev5kpiRclrnFV1txqos8TxJe0To+oVOCUIyfS1pwL/a+lKaA3i6Q95Ew5 2mp5vrXnTv1a+H7X5Z+t5g48WOI1SU8/zyI/lkAglKD8MYCvvwDTXOrSE/xpYJj1RIunsPA+rR8UuQ R0Jz/tirzeIl02TNMdDRy++WE+MnwsO+SukspwZ1PVIZ6cQFXlHWgwCoaoS/cnmm9tybzEX3mOLZVb 7nzSI6YCjtu2E2ZdVPc/8SAIOUpSvoTIN7nQH/sYhzGHAv0HetJvo+cIuca2xGl9Aii/98PmSohOpU Zyh2TNEBAJ/6QNdT2vfx9VdxtpjC4WA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=JOYJ06taVcvo7lkh53LM4DKiwj8s8qjlt9+HZc4Ado0=; b=ih1qCyBU9X/gf+bVr9sviGb4IsPcOhrYZBKIDwscKDtxoX6K69EMoAeCtot+VOgvfkYpBcepeNwfZ lC1rgejXdeZrH2ogrcF8p60rKW1kb/eRb/2ywV/gc+sa0ymXsgnJqQzOvMhhlIfTDCp81AHxYdHXE/ LlCMGToeihdl+WMM/gm2nV91DIxtFdkSmGoLC42wVen5NRubgTSEmBBZxpl0kn+uHK2+DGBcIA7PzQ 29pKKb+3TdPQoM/8AyQM/oevx9ElpVqwH9JqGJ+kVIfGXvZDtnK2UVsOHD1NtOHmVsvUlq1BUszORx o+yCYKyemiDZXBSTD48ksxEeLho25Ag== X-MHO-RoutePath: aGlwcGll X-MHO-User: d1dced10-03c8-11e9-befd-af03bedce89f X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id d1dced10-03c8-11e9-befd-af03bedce89f; Wed, 19 Dec 2018 20:01:06 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id wBJK1bDf097637; Wed, 19 Dec 2018 13:01:37 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1545249697.76088.176.camel@freebsd.org> Subject: Re: Composite PCI devices in FreeBSD (mfd in Linux) From: Ian Lepore To: Anthony Jenkins , John Baldwin Cc: FreeBSD CURRENT , Gleb Popov <6yearold@gmail.com> Date: Wed, 19 Dec 2018 13:01:37 -0700 In-Reply-To: <1c3e555d-7289-1219-8c66-07f75a335dc0@yahoo.com> References: <1544473194.1860.340.camel@freebsd.org> <05b1183c-6117-267b-42f9-19e750adfa07@FreeBSD.org> <02e30a11-4adf-3efb-d2ce-89c598bda9cf@yahoo.com> <1c3e555d-7289-1219-8c66-07f75a335dc0@yahoo.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0F42B6B172 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2018 20:01:48 -0000 On Wed, 2018-12-19 at 14:35 -0500, Anthony Jenkins wrote: > On 12/19/18 10:41 AM, Anthony Jenkins wrote: > > > > [snip] > > > > I'm not feeling too confident about the condition of the FreeBSD > > ig4  > > driver; the PCI attach code was calling pci_alloc_msi() wrong, > > passing  > > a pointer to the rid (0) instead of a pointer to a count variable, > > and  > > not passing bus_alloc_resource_any() an IRQ rid > 0 if it has an > > MSI.   > > I'd be happy(er) if ig4 created a /dev/iic0 node - I figured > > iicbus(4)  > > took care of all that... > > > > https://github.com/ScoobiFreeBSD/freebsd-intel-lpss > > > Found it!  I didn't declare ig4_iic to include the ig4_lpss as a  > sub-device.  Now it at least /looks/ like I'm getting I2C devices > found  > on both my DesignWare I2C busses. > > diff --git a/sys/dev/ichiic/ig4_iic.c b/sys/dev/ichiic/ig4_iic.c > index 6bbe417..34c1adb 100644 > --- a/sys/dev/ichiic/ig4_iic.c > +++ b/sys/dev/ichiic/ig4_iic.c > @@ -802,3 +802,4 @@ ig4iic_dump(ig4iic_softc_t *sc) > >   DRIVER_MODULE(iicbus, ig4iic_acpi, iicbus_driver, iicbus_devclass,  > NULL, NULL); >   DRIVER_MODULE(iicbus, ig4iic_pci, iicbus_driver, iicbus_devclass,  > NULL, NULL); > +DRIVER_MODULE(iicbus, ig4iic_lpss, iicbus_driver, iicbus_devclass,  > NULL, NULL); That new DRIVER_MODULE() statement should be in your new driver, not in ig4_iic.c. Those other two statements should also be moved into their corresponding source code files. At least, that's the precedent followed by all the i2c controller drivers except ig4_iic: the DRIVER_MODULE() statement that establishes the connection between iicbus and the controller lives right alongside the DRIVER_MODULE() statement that establishes the connection between the controller and the bus it sits on. See, for example:  sys/dev/glxiic/glxiic.c  sys/dev/iicbus/iicoc.c -- Ian