diff options
author | Ivan Kokshaysky <ink@jurassic.park.msu.ru> | 2008-03-30 11:50:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-21 00:47:08 -0400 |
commit | 884525655d07fdee9245716b998ecdc45cdd8007 (patch) | |
tree | 975cbf2b5079430240d3496323df1a266be95d27 /drivers/pci/probe.c | |
parent | d75b305295c38ba9610ff3b2200f7d1989dc55fd (diff) |
PCI: clean up resource alignment management
Done per Linus' request and suggestions. Linus has explained that
better than I'll be able to explain:
On Thu, Mar 27, 2008 at 10:12:10AM -0700, Linus Torvalds wrote:
> Actually, before we go any further, there might be a less intrusive
> alternative: add just a couple of flags to the resource flags field (we
> still have something like 8 unused bits on 32-bit), and use those to
> implement a generic "resource_alignment()" routine.
>
> Two flags would do it:
>
> - IORESOURCE_SIZEALIGN: size indicates alignment (regular PCI device
> resources)
>
> - IORESOURCE_STARTALIGN: start field is alignment (PCI bus resources
> during probing)
>
> and then the case of both flags zero (or both bits set) would actually be
> "invalid", and we would also clear the IORESOURCE_STARTALIGN flag when we
> actually allocate the resource (so that we don't use the "start" field as
> alignment incorrectly when it no longer indicates alignment).
>
> That wouldn't be totally generic, but it would have the nice property of
> automatically at least add sanity checking for that whole "res->start has
> the odd meaning of 'alignment' during probing" and remove the need for a
> new field, and it would allow us to have a generic "resource_alignment()"
> routine that just gets a resource pointer.
Besides, I removed IORESOURCE_BUS_HAS_VGA flag which was unused for ages.
Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Gary Hade <garyhade@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index c2e99fd87faf..33d9b8bea6e0 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -235,7 +235,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) | |||
235 | res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK; | 235 | res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK; |
236 | } | 236 | } |
237 | res->end = res->start + (unsigned long) sz; | 237 | res->end = res->start + (unsigned long) sz; |
238 | res->flags |= pci_calc_resource_flags(l); | 238 | res->flags |= pci_calc_resource_flags(l) | IORESOURCE_SIZEALIGN; |
239 | if (is_64bit_memory(l)) { | 239 | if (is_64bit_memory(l)) { |
240 | u32 szhi, lhi; | 240 | u32 szhi, lhi; |
241 | 241 | ||
@@ -288,7 +288,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) | |||
288 | if (sz) { | 288 | if (sz) { |
289 | res->flags = (l & IORESOURCE_ROM_ENABLE) | | 289 | res->flags = (l & IORESOURCE_ROM_ENABLE) | |
290 | IORESOURCE_MEM | IORESOURCE_PREFETCH | | 290 | IORESOURCE_MEM | IORESOURCE_PREFETCH | |
291 | IORESOURCE_READONLY | IORESOURCE_CACHEABLE; | 291 | IORESOURCE_READONLY | IORESOURCE_CACHEABLE | |
292 | IORESOURCE_SIZEALIGN; | ||
292 | res->start = l & PCI_ROM_ADDRESS_MASK; | 293 | res->start = l & PCI_ROM_ADDRESS_MASK; |
293 | res->end = res->start + (unsigned long) sz; | 294 | res->end = res->start + (unsigned long) sz; |
294 | } | 295 | } |