From owner-freebsd-hackers@FreeBSD.ORG Sat Nov 15 07:08:10 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 563A05DC for ; Sat, 15 Nov 2014 07:08:10 +0000 (UTC) Received: from ipmail05.adl6.internode.on.net (ipmail05.adl6.internode.on.net [150.101.137.143]) by mx1.freebsd.org (Postfix) with ESMTP id D699B145 for ; Sat, 15 Nov 2014 07:08:09 +0000 (UTC) Received: from ppp118-210-137-175.lns20.adl6.internode.on.net (HELO midget.dons.net.au) ([118.210.137.175]) by ipmail05.adl6.internode.on.net with ESMTP; 15 Nov 2014 17:32:59 +1030 Received: from [10.0.2.95] ([10.0.2.95]) (authenticated bits=0) by midget.dons.net.au (8.14.6/8.14.4) with ESMTP id sAF72eNb097129 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 15 Nov 2014 17:32:47 +1030 (CST) (envelope-from darius@dons.net.au) From: "O'Connor, Daniel" Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Date: Sat, 15 Nov 2014 17:32:39 +1030 Subject: Newbus question To: FreeBSD Hackers Message-Id: Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) X-Spam-Score: -1.105 () BAYES_00,HELO_MISC_IP,RDNS_NONE,URIBL_BLOCKED X-Scanned-By: MIMEDefang 2.73 on 10.0.2.1 X-Mailman-Approved-At: Sat, 15 Nov 2014 12:28:09 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Nov 2014 07:08:10 -0000 Hi, I am trying to write a driver for the EHCI debug port [1]. I found some = userland code which I got working (written by the person who did the = Linux version) and now I am trying to get it running in the kernel. One = problem I have is that it needs to run in parallel with the normal EHCI = controller. It uses the same BAR as the EHCI controller but offset (the = offset is found in a PCI capability). I think I can bus_alloc_resource() = if I change EHCI to allocate with RF_SHAREABLE but my first problem is = to add another device so my driver doesn=92t contest with the EHCI = driver. Currently I have a module which loops over bus/slot/func using find_bsf = (is there a way to enumerate all connected PCI devices?) and then check = each for the debug capability (I plan on being a bit pickier later but = it works so far) then creating a child device. The problem is that the = probe routine=20 The code I have so far is at = https://gist.github.com/DanielO/f0f6643de567981a9a10 and the output I = get is.. Driver is dbgp Probed Driver is dbgp Probed Driver is dbgp Probed Driver is dbgp Probed Driver is dbgp Probed Driver is dbgp Probed =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D MOD_LOAD =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Found debug capability on 0.26.0 at 0xa0 map 0x14 start 0xf7f18000 length 1024 Child already present Found debug capability on 0.29.0 at 0xa0 map 0x14 start 0xf7f17000 length 1024 Child already present This is after a fresh reboot so I am a little perplexed.. 1 - Appendix C of = http://www.intel.com.au/content/dam/www/public/us/en/documents/technical-s= pecifications/ehci-specification-for-usb.pdf - http://komposter.com.ua/documents/USB-2.0-Debug-Port(John-Keys).pdf = has a nice overview -- Daniel O'Connor "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C