From owner-freebsd-current@FreeBSD.ORG Mon Apr 6 20:18:26 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E579CB for ; Mon, 6 Apr 2015 20:18:26 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0668BEA7 for ; Mon, 6 Apr 2015 20:18:26 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 989BDB91F; Mon, 6 Apr 2015 16:18:24 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Subject: Re: How to hotplug pci/e devices in freeBSD? (Or How to remove and rescan/re-enumerate pci device?) Date: Mon, 06 Apr 2015 16:11:07 -0400 Message-ID: <4602978.mfxsXe7cu8@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 06 Apr 2015 16:18:24 -0400 (EDT) Cc: Eran Harpaz X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 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: Mon, 06 Apr 2015 20:18:26 -0000 On Thursday, April 02, 2015 10:17:47 AM Eran Harpaz wrote: > I'm looking for a way to refresh/re-enumerate the pci device list. > > In Linux, you can remove a particular pci device, and then after preforming > a "rescan" the device will appear again. In Linux it is done by: > > echo 1 > /sys/bus/pci/devices/.../remove > echo 1 > /sys/bus/pci/rescan > > I'm looking for a similar functionality in freeBSD. > > *What do I want to achieve?* > > I'm using freeBSD and my pcie device can be reset from the host. But when > it boots again, it's uncommunicative, so I want to rescan the pci devices > in order to initiate a new connection between the host and the device. > > Any idea would be appreciated, even if it takes some coding effort. This is not currently supported. Hotplug support is being worked on by jmg@. However, if you want to rescan a non-hotplug device (e.g. flashing an FPGA board), then I can probably add extensions to devctl in HEAD to let you do this. -- John Baldwin