From owner-freebsd-current@FreeBSD.ORG Tue Jan 30 16:56:44 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 8BFAB16A400 for ; Tue, 30 Jan 2007 16:56:44 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 5038013C48E for ; Tue, 30 Jan 2007 16:56:44 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.samsco.home (phobos.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id l0UGuVkf077397; Tue, 30 Jan 2007 09:56:37 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <45BF78B5.1050305@samsco.org> Date: Tue, 30 Jan 2007 09:56:21 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1 MIME-Version: 1.0 To: Andrew Gallatin References: <17855.30388.764471.322562@grasshopper.cs.duke.edu> In-Reply-To: <17855.30388.764471.322562@grasshopper.cs.duke.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (pooker.samsco.org [168.103.85.57]); Tue, 30 Jan 2007 09:56:37 -0700 (MST) X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on pooker.samsco.org Cc: freebsd-current@freebsd.org Subject: Re: 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:56:44 -0000 Andrew Gallatin wrote: > 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 > I need to do the same thing, and I concluded that pci_cfg_restore needs to be exported out via a DEVMETHOD. It might also be useful to export a pci_cfg_save function. Scott