[lkml]   [2001]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Possible PCI subsystem bug in 2.4
Linus Torvalds wrote:
> On Thu, 3 May 2001, Alan Cox wrote:
> >
> > Obvious one is to go to the next power of two clear.
> The question is mainly _which_ power of two.
> I don't think we can round up infinitely, as that might just end up
> causing us to not have any PCI space at all. Or we could end up deciding
> that real PCI space is memory, and then getting a clash when a real device
> tries to register its bios-allocated area that clashes with our extreme
> rounding.
> I suspect it would be safe to round up to the next megabyte, possibly up
> to 64MB or so. But much more would make me nervous.
> Any suggestions?

The amount of RAM in a machine almost always has just one or two "1"

8, 16, 20, 24, 32, 36, 40, 48, 64, 80 Mb were the numbers that you'd
see in the early Pentium times, right?

So rounding up would mean: Add one until the number of 1-bits in the
address is less than 3. People with 3 or more differently sized DIMMS
in their machine will experience a slightly ineffcient round-up.

Speed this up with: Find-lowest-1-bit, add that.

Example you quoted:
nr of 1 bits.
BIOS-proclaimed end-of-ram: 0x13fff0000 15
lowest 1-bit: 0x000010000 1
add: 0x140000000 2

long round_highmem (long val)
while (hweight32 (val) > 2)
val += 1 << ffs (val);
return val;


** ** ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots.
* There are also old, bald pilots.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:52    [W:0.071 / U:1.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site