From 8a3d0b80edc3f9fa9766a2c46cbefd7954602408 Mon Sep 17 00:00:00 2001 From: Ivan Kokshaysky Date: Mon, 6 May 2002 20:27:32 -0700 Subject: [PATCH] 2.5.14: New PCI allocation code (alpha, arm, parisc) [1/2] This changes PCI resource allocation algorithm to 3 passes vs. current 2 passes. Extra pass is used for calculation of required size and alignment of PCI buses behind PCI-PCI bridges. After that, in the pass #3, these buses get allocated like regular PCI devices. This gives tighter PCI IO and memory packing - for instance, this fixes allocation problems on certain alphas with very small (112Mb) PCI memory range. Also, the new code - will allow mixed approach to resource allocation: architecture can keep BIOS settings for some devices, and re-allocate resources for others, including improperly initialized bridges; - makes prefetchable ranges support much simpler; - allows sizing of IO and memory ranges for the host bridges, which might be very useful in some situations. It was tested on various alphas; I haven't heard any complaints from rmk and rth, so probably all of this is ok. :-) Part 1: - for all archs, 4th argument (align) added to pcibios_align_resource (and its callers). It's necessary because this function will be called for bus resources as well, and in this case size != alignment. - for several archs, dead/bogus code removed from pcibios_fixup_pbus_ranges(). --- kernel/resource.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'kernel') diff --git a/kernel/resource.c b/kernel/resource.c index 7804ab3230d1..bf331c1092ed 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -152,7 +152,8 @@ static int find_resource(struct resource *root, struct resource *new, unsigned long size, unsigned long min, unsigned long max, unsigned long align, - void (*alignf)(void *, struct resource *, unsigned long), + void (*alignf)(void *, struct resource *, + unsigned long, unsigned long), void *alignf_data) { struct resource *this = root->child; @@ -169,7 +170,7 @@ static int find_resource(struct resource *root, struct resource *new, new->end = max; new->start = (new->start + align - 1) & ~(align - 1); if (alignf) - alignf(alignf_data, new, size); + alignf(alignf_data, new, size, align); if (new->start < new->end && new->end - new->start + 1 >= size) { new->end = new->start + size - 1; return 0; @@ -189,7 +190,8 @@ int allocate_resource(struct resource *root, struct resource *new, unsigned long size, unsigned long min, unsigned long max, unsigned long align, - void (*alignf)(void *, struct resource *, unsigned long), + void (*alignf)(void *, struct resource *, + unsigned long, unsigned long), void *alignf_data) { int err; -- cgit v1.2.3