How should I deal with a PCI resource not aligned to a page boundary?

Alex Villací­s Lasso a_villacis at palosanto.com
Wed Feb 17 09:13:59 PST 2010


After writing a somewhat functional xorg driver for the OAK Spitfire 
OTI64111 video card, I am trying to modify the driver to support the 
OTI64107 video card, which I have plugged in my test machine. The first 
strange thing that I notice about this card is that it reports a MMIO 
region that is not aligned to a page boundary (4096 bytes on this x86 
PC). Instead it reports an physical address like 0xffeff800, both 
through lspci and through libpciaccess within my driver code. If I try 
to map this resource, I get a page-aligned address, but trying to 
actually use the resource at this mapping has no effect in the card. To 
get around this, I have done the following: extract the lower bits of 
the resource with (resource & 0xfff), and use these bits as an offset 
within the mapping. I do get access to the MMIO by doing this, but it 
feels like an ugly hack. What is the official way of dealing with this 
situation? What measures should I take when compiling this for a 
different architecture, or a 64-bit machine?



More information about the xorg mailing list