Re: [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC

From: Harald Welte
Date: Fri Dec 26 2003 - 03:57:39 EST


On Wed, Dec 24, 2003 at 12:04:33PM -0800, Greg KH wrote:
> On Wed, Dec 24, 2003 at 12:10:55PM +0100, Harald Welte wrote:
> > After investigating differences in the PCI code of 2.4.x and 2.6.x, i
> > noticed that 2.4.x/arc/ppc/kernel/pci.c:pcibios_update_resource()
> > contained a couple of lines that unset the IORESOURCE_UNSET bitflag.
> >
> > In 2.6.x, this is handled by the generic PCI core in
> > drivers/pci/setup-res.c:pci_update_resource() code. However, the code
> > is missing the 'res->flags &= ~IORESOURCE_UNSET' part.
> >
> > The below fix re-adds that section from 2.4.x.
> >
> > I'm not sure wether this belongs into the arch-independent PCI api.
> > Anyway, on PPC it seems to be needed for certain cardbus devices.
>
> Is there any way you can add this to the ppc arch specific code, as
> that's the only platform that seems to want this, right?

AFAICT: Not a straight-forward one. The reason seems to be that in
2.4.x every PCI arch implementation could specify it's own
update_resource() function, whereas in 2.6.x this is all handled by the
core.

A quick grep of the kernel source revealed that only
arch/ppc/kernel/pci.c ever sets an IORESOURCE_UNSET flag. So there is
no possibility for non-ppc arch's of ever having set that flag. Maybe
the overall PPC pci implementation could be changed... instead of
setting that flag in fixup_resources() and later on re-assigning the
resoure in update_resource(), we could directly re-assign the resource
in fixup_resources().

But remember, I'm a packet filter guy, not a PCI geek, nor a PPC
hardware geek.

Consider my original email as:

"I've found a problem, fixed it somehow (albeit not really knowing the
code I've touched). PPC and PCI guys, please review."

So if there is an arch-specific way of solving this in a different way,
BenH or the other LinuxPPC guys would know how.

I'm happy to test any proposed alternative fix and give feedback.

> thanks,
> greg k-h

--
- Harald Welte <laforge@xxxxxxxxxxxx> http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime

Attachment: pgp00000.pgp
Description: PGP signature