cvs commit: src/sys/dev/pci pci.c

Scott Long scottl at freebsd.org
Fri May 21 01:21:55 PDT 2004


M. Warner Losh wrote:
> In message: <40ADAF07.2070909 at freebsd.org>
>             Scott Long <scottl at freebsd.org> writes:
> : Warner Losh wrote:
> : > imp         2004/05/20 23:36:36 PDT
> : > 
> : >   FreeBSD src repository
> : > 
> : >   Modified files:
> : >     sys/dev/pci          pci.c 
> : >   Log:
> : >   MFp4: o save/restore subvendor, subdevice, vendor, device, baseclass,
> : >           subclass, progif and revid.  While these are typically read
> : >           only fields, they aren't always read-only.  progif is writable
> : >           for ata devices, for example.  It does no harm when they are
> : >           read only, and helps when they aren't.
> : >   
> : >   Revision  Changes    Path
> : >   1.252     +16 -0     src/sys/dev/pci/pci.c
> : 
> : Shouldn't it be left up to the device drivers to decide if a buggy piece
> : of silicon needs to be touched like this?  I really don't like the bus
> : unilaterally enforcing this on everything.
> 
> This just preserves the values across a D3 -> D0 state transition.
> This seems to be required by the 1.1 version of the pci power spec:
> 
> 	Section 5.4: "When a function is brought back to D0...,
> 	software will need to perform a full initialization of the
> 	function, including its PCI Configuration space."
> 
> 	Section 8.3.3: For example, reinitialization includes, but is
> 	not necessarily limited to, restoring the Base Address
> 	registers, re-enabling the I/O and memory spaces, re-enabling
> 	bus master capabilities, and unmasking any IRQs or PCI
> 	Interrupts as well as restoring the INT Line
> 	register. Furthermore, if the function has the DSI bit set,
> 	the operating system is required to execute whatever
> 	initialization code is necessary, either via the device
> 	driver's initialization code or by executing POST.
> 
> My reading of these two sections lead me to save this information.
> 
> Warner

Well, the 8.3.3 paragraph only specifically mentions the command
register and the BARs.  I'm just worried that by touching stuff outside
of this range that you open up the risk of tickling latent buggy
silicon.  Exception cases like the ATA hardware doing magic things with
the progif register should be left up to the ATA driver.  It's exactly
those kinds of bent-rules that makes me nervous =-)


Scott


More information about the cvs-src mailing list