lkml.org 
[lkml]   [2003]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectSimplification in pbus_size_mem
The following patch is against 2.4, but the 2.6 code looks identical.

===== setup-bus.c 1.6 vs edited =====
--- 1.6/drivers/pci/setup-bus.c Thu Dec 12 22:14:01 2002
+++ edited/setup-bus.c Thu Nov 20 11:54:28 2003
@@ -311,18 +311,8 @@
}
}

- align = 0;
- min_align = 0;
- for (order = 0; order <= max_order; order++) {
- unsigned long align1 = 1UL << (order + 20);
+ min_align = 1UL << (max_order + 20);

- if (!align)
- min_align = align1;
- else if (ROUND_UP(align + min_align, min_align) < align1)
- min_align = align1 >> 1;
- align += aligns[order];
- }
- size = ROUND_UP(size, min_align);
if (!size) {
b_res->flags = 0;
return;

This is fixing the allocation on a system which looks like this

* 96Mb PCI memory aperture
* Kyro graphics card, requiring 64Mb + 768kb prefetchable
* USB card requiring 4x4k non-prefetchable

Without the change, 'min_align' is computed as 32Mb (the algorithm in the
loop basically seems to make 'min_align' end up as 1/2 the largest
alignment requirement that was found?), hence in the pass where the
prefetchable block is sized, 'size' ends up as 96Mb, which means there
is no space left in which to place the non-prefetchable blocks for the
USB card.

With the patch above, the alignment requirement for the prefetchable
memory actually ends up as the alignment required for the framebuffer,
and the size isn't rounded up unnecessarily. The USB card gets
allocated successfully as a result.

I couldn't be sure what the code in the loop is attempting to do, so I'm
sure I'm overlooking something subtle. Any comments?

--
Richard \\\ SuperH Core+Debug Architect /// .. At home ..
P. /// richard.curnow@superh.com /// rc@rc0.org.uk
Curnow \\\ http://www.superh.com/ /// www.rc0.org.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.033 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site