From owner-freebsd-current@FreeBSD.ORG Thu Apr 2 07:17:55 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 3F200266 for ; Thu, 2 Apr 2015 07:17:55 +0000 (UTC) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53]) (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 BE32A211 for ; Thu, 2 Apr 2015 07:17:54 +0000 (UTC) Received: by lajy8 with SMTP id y8so53553603laj.0 for ; Thu, 02 Apr 2015 00:17:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=npK22xDA8gT7K7mv8SfVNK0VkFhGbpYTELhR3l1/KAM=; b=WQd9tpuP6N8eM8JXRpzI+OU3du5oshNr6mTzS7+MCOlmimOUIoiGJ3P5iN+Rsc/ufV v9xrfDEo2phCMQtRK6H8lJJcid1L2Y+AWlB/VX8+lAqc9IoBNzQkaOsytBMyly2P6JM2 dlwuC85EZdkiUB+Q6FcmpxQlQdT6tQQILlmQ5DpbSzsspe/46jNFY4x0TnTSjK1hv1zc TN5QMKfwYb5Pg4iD+gij2QKkRrltTmwb6zD7ZypNThDT8hWQQOmKjM9LcvTFKRLJcqIh UOF3bLSvyGy06Lc+v7m01mEtFI1gp3CvgqFbpbBkU9kGerggbpfwi/J34dTUeKGbnT/G 4DMg== X-Gm-Message-State: ALoCoQk+WexGHvBDBBb82Zimtte9L60Ox3WtsD5z060hlwCass7K88nT6vTjnjaOCvMPEoF2Q4KN MIME-Version: 1.0 X-Received: by 10.152.239.135 with SMTP id vs7mr4029247lac.104.1427959067046; Thu, 02 Apr 2015 00:17:47 -0700 (PDT) Received: by 10.25.31.2 with HTTP; Thu, 2 Apr 2015 00:17:47 -0700 (PDT) Date: Thu, 2 Apr 2015 10:17:47 +0300 Message-ID: Subject: How to hotplug pci/e devices in freeBSD? (Or How to remove and rescan/re-enumerate pci device?) From: Eran Harpaz To: freebsd-current@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 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: Thu, 02 Apr 2015 07:17:55 -0000 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. Thanks!