From owner-freebsd-current@FreeBSD.ORG Tue Jan 30 16:47:55 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 290EE16A401 for ; Tue, 30 Jan 2007 16:47:55 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.freebsd.org (Postfix) with ESMTP id E325B13C474 for ; Tue, 30 Jan 2007 16:47:54 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.13.6/8.13.6) with ESMTP id l0UGlsGR019881 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 30 Jan 2007 11:47:54 -0500 (EST) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.12.9p2/8.12.9/Submit) id l0UGlmQs034776; Tue, 30 Jan 2007 11:47:48 -0500 (EST) (envelope-from gallatin) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17855.30388.764471.322562@grasshopper.cs.duke.edu> Date: Tue, 30 Jan 2007 11:47:48 -0500 (EST) To: freebsd-current@freebsd.org X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Subject: restoring PCI config space X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 30 Jan 2007 16:47:55 -0000 I need to write a watchdog handler for mxge(4). The catch is that if the NIC resets due to a hardware error, it will reset its config space (setting BAR to 0, disabling DMA, forgetting MSI addr/data, etc), so the driver's watchdog handler needs to be able to restore it. How do I do this properly on FreeBSD? Browsing around the source tree, I see that the pci function pci_cfg_restore() seems to do exactly what I want, but it is private to the pci code, and seems to be called from the bowels of the resume path. Is there a clean way I can leverage pci_cfg_restore(), or should I just save an extra copy of the device's PCI config space myself? Thanks, Drew