public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC
@ 2003-12-24 11:10 Harald Welte
  2003-12-24 20:04 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Harald Welte @ 2003-12-24 11:10 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]

Hi!

[disclaimer:  This was posted on the linuxppc list before, BenH asked me 
 to re-post it to lkml]

The prism54 (http://prism54.org) driver for my cardbus adapter works
with 2.4.x, but not 2.6.x on a Titanium G4 Powerbook IV.

On 2.6.x the error message was
PCI:0001:02:00.0 Resource 0 [00000000-00001fff] is unassigned

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.

Any comments welcome.

diff -Nru linuxppc25bh-031214-plain/drivers/pci/setup-res.c linuxppc25bh-031214-orinoco_monitor/drivers/pci/setup-res.c
--- linuxppc25bh-031214-plain/drivers/pci/setup-res.c	2003-12-05 02:37:16.000000000 +0100
+++ linuxppc25bh-031214-orinoco_monitor/drivers/pci/setup-res.c	2003-12-15 12:08:11.000000000 +0100
@@ -84,6 +84,10 @@
 			       pci_name(dev), resno, new, check);
 		}
 	}
+	res->flags &= ~IORESOURCE_UNSET;
+	printk(KERN_INFO "PCI: moved device %s resource %d (%lx) to %x\n",
+		dev->slot_name, resno, res->flags,
+		new & ~PCI_REGION_FLAG_MASK);
 }
 
 int __init

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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC
  2003-12-24 11:10 [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC Harald Welte
@ 2003-12-24 20:04 ` Greg KH
  2003-12-24 20:33   ` Safe ISA port probing? Ben Srour
  2003-12-26  8:46   ` [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC Harald Welte
  0 siblings, 2 replies; 5+ messages in thread
From: Greg KH @ 2003-12-24 20:04 UTC (permalink / raw)
  To: Harald Welte; +Cc: linux-kernel

On Wed, Dec 24, 2003 at 12:10:55PM +0100, Harald Welte wrote:
> Hi!
> 
> [disclaimer:  This was posted on the linuxppc list before, BenH asked me 
>  to re-post it to lkml]
> 
> The prism54 (http://prism54.org) driver for my cardbus adapter works
> with 2.4.x, but not 2.6.x on a Titanium G4 Powerbook IV.
> 
> On 2.6.x the error message was
> PCI:0001:02:00.0 Resource 0 [00000000-00001fff] is unassigned
> 
> 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?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Safe ISA port probing?
  2003-12-24 20:04 ` Greg KH
@ 2003-12-24 20:33   ` Ben Srour
  2003-12-24 21:12     ` Randy.Dunlap
  2003-12-26  8:46   ` [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC Harald Welte
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Srour @ 2003-12-24 20:33 UTC (permalink / raw)
  To: linux-kernel

Hello,

What is the safest way to go about probing for non-pnp ISA devices on a
system?

Is the only solution to start at a base address and increment until you
find something interesting? Won't this put devices along the way in an
unsafe state?

Any advice/suggestions would be appreciated,

Thanks
Ben

-- 
Ben Srour
srour@cs.wisc.edu


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Safe ISA port probing?
  2003-12-24 20:33   ` Safe ISA port probing? Ben Srour
@ 2003-12-24 21:12     ` Randy.Dunlap
  0 siblings, 0 replies; 5+ messages in thread
From: Randy.Dunlap @ 2003-12-24 21:12 UTC (permalink / raw)
  To: Ben Srour; +Cc: linux-kernel

On Wed, 24 Dec 2003 14:33:54 -0600 (CST) Ben Srour <srour@cs.wisc.edu> wrote:

| Hello,
| 
| What is the safest way to go about probing for non-pnp ISA devices on a
| system?

To be very safe, use a parameter and don't do probing, except to
verify that the device is where you have been told it is.

| Is the only solution to start at a base address and increment until you
| find something interesting? Won't this put devices along the way in an
| unsafe state?

It could.

| Any advice/suggestions would be appreciated,

There's not a method that's always safe AFAIK.

It's better to use reads instead of writes if possible.
It's better to begin at the least-used addresses of other
known devices as much as possible (but you know that).

--
~Randy
MOTD:  Always include version info.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC
  2003-12-24 20:04 ` Greg KH
  2003-12-24 20:33   ` Safe ISA port probing? Ben Srour
@ 2003-12-26  8:46   ` Harald Welte
  1 sibling, 0 replies; 5+ messages in thread
From: Harald Welte @ 2003-12-26  8:46 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, linuxppc-dev, Benjamin Herrenschmidt

[-- Attachment #1: Type: text/plain, Size: 2240 bytes --]

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@gnumonks.org>               http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-12-26  8:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-24 11:10 [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC Harald Welte
2003-12-24 20:04 ` Greg KH
2003-12-24 20:33   ` Safe ISA port probing? Ben Srour
2003-12-24 21:12     ` Randy.Dunlap
2003-12-26  8:46   ` [PATCH 2.6] fix pci_update_resource() / IORESOURCE_UNSET on PPC Harald Welte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox