Re: A quick question about the Command register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 23, 2009 at 03:24:14PM +1100, Timothy S. Nelson wrote:
> 	Hi all.  I've inserted the patch I want to ask about below.  It's
> supposed 
> to be an updated version of the patch that produces sensible errors if 
> people try to read a ROM incorrectly.  The problem seems to be with the 
> line that says:
>
> if(! res->flags & IORESOURCE_MEM) {
>
> 	Now since that line was written by me, it's no doubt wrong.  What it's 
> supposed to be testing for is whether the Memory Space bit in the Command 
> register is set, and run the code inside the if statement if it's NOT set. 

This doesn't test state of the Command register.
It tests if the resource is memory address space or IO Port address space.

> Would you expect the code that I wrote to do that?

No. (Besides the operator precedence that I also overlooked)

>
> 	I should state that this code is designed to catch the case where a "1" 
> hasn't been echoed into the file called "enable" yet.  It is possible that 
> res->flags might not be initialised properly?  If that's the case, how do I 
> check for enabled-ness?

Do what you said you wanted: Read the command register and test the
PCI_COMMAND_MEMORY bit.  "fgrep PCI_COMMAND_MEMORY drivers/pci/*.c"
will give two examples.

hth,
grant
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux