From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 27 09:20:59 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73E481065674 for ; Thu, 27 Jan 2011 09:20:59 +0000 (UTC) (envelope-from philip-freebsd1@soeberg.net) Received: from pasmtpA.tele.dk (pasmtpa.tele.dk [80.160.77.114]) by mx1.freebsd.org (Postfix) with ESMTP id 357138FC0C for ; Thu, 27 Jan 2011 09:20:58 +0000 (UTC) Received: from mail.soeberg.net (0x573f534a.cpe.ge-1-1-0-1109.bynqu1.customer.tele.dk [87.63.83.74]) by pasmtpA.tele.dk (Postfix) with ESMTP id DC6E58006A5 for ; Thu, 27 Jan 2011 10:20:57 +0100 (CET) Received: from [10.240.10.87] ([188.120.77.114]) (authenticated user philip@soeberg.net) by mail.soeberg.net (using TLSv1/SSLv3 with cipher AES256-SHA (256 bits)) for freebsd-hackers@freebsd.org; Thu, 27 Jan 2011 10:21:08 +0100 Message-ID: <4D413936.8070301@soeberg.net> Date: Thu, 27 Jan 2011 10:21:58 +0100 From: Philip Soeberg User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4D3EE287.3010203@soeberg.net> <201101251355.53944.jhb@freebsd.org> In-Reply-To: <201101251355.53944.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: pci_suspend/pci_resume of custom pcie board X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: philip-freebsd1@soeberg.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2011 09:20:59 -0000 On 25-01-2011 19:55, John Baldwin wrote: > Use this: > > pci_cfg_save(dev, dinfo, 0); > pci_set_powerstate(dev, PCI_POWERSTATE_D3); > > /* do stuff */ > > /* Will set state to D0. */ > pci_cfg_restore(dev, dinfo); > > We probably should create some wrapper routines (pci_save_state() and > pci_restore_state() would be fine) that hide the 'dinfo' detail as that isn't > something device drivers should have to know. Excellent, Thank you.. I must have been half asleep as couldn't for the love of god get that config space restore to work when I tried it yesterday, but now all is peachy. Must have forgotten a crucial step in that.. 3 step list you provided.. sighh.. :) No need to wrap dinfo.. It's actually quite nice to have the cache at hand -if- the device should "choose" to change a parameter, say its device id. I'd rather we'd focus on extending the PCI_POWERSTATE_D3 to include a specific Hot version. D3 can mean both Cold and Hot, and there's a distinct difference between the two (whether to remove power from the device or not).. Not that I know of any PM implementation who actually differentiates as of yet, but I wouldn't be surprised if all this green energy wave thing we see in the server segment push towards powering off a slot once its device has entered d3cold. Anyway, Many thanks for your help. /Phil