pci-mvebu driver on km_kirkwood
From: Jason Gunthorpe <hidden>
Date: 2014-02-21 16:39:02
Also in:
linux-pci
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