Thread (53 messages) 53 messages, 9 authors, 2014-02-23

pci-mvebu driver on km_kirkwood

From: Jason Gunthorpe <hidden>
Date: 2014-02-21 16:39:02
Also in: linux-pci

On Fri, Feb 21, 2014 at 02:47:08PM +0100, Thomas Petazzoni wrote:
 *) I don't know if the algorithm to split the BAR into multiple
    windows is going to be trivial.
physaddr_t base,size;

while (size != 0) {
   physaddr_t window_size = 1 << log2_round_down(size);
   create_window(base,window_size);
   base += window_size;
   size -= window_size;
}

At the very worst log2_round_down is approxmiately

unsigned int log2_round_down(unsigned int val)
{
	unsigned int res = 0;
	while ((1<<res) <= val)
		res++;
	return res - 1;
}

Minimum PCI required alignment for windows is 1MB so it will always
work out into some number of mbus windows..

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help