* pmac serial_pci_guess_board problem
@ 2005-11-04 21:27 Geoff Levand
2005-11-04 21:47 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Geoff Levand @ 2005-11-04 21:27 UTC (permalink / raw)
To: rmk+serial; +Cc: linux-serial, Benjamin Herrenschmidt
Russell,
I found that the serial port probe code in drivers/serial/8250_pci.c
no longer works properly for PowerMac G5 in 2.6.14. It seems some new
code now takes the PCI device info directly from the G5's Open
Firmware. The trouble is that OF sets the address length to 16 bytes,
not the expected 8 bytes.
Here's a fix, but I'd be interested to hear your comments.
-Geoff
Index: linux-2.6.14/drivers/serial/8250_pci.c
===================================================================
--- linux-2.6.14.orig/drivers/serial/8250_pci.c 2005-11-04 11:41:09.000000000 -0800
+++ linux-2.6.14/drivers/serial/8250_pci.c 2005-11-04 11:44:21.000000000 -0800
@@ -1478,7 +1478,11 @@
num_port = 0;
for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
+#if defined(CONFIG_PPC_PMAC64)
+ pci_resource_len(dev, i) == 16 &&
+#else
pci_resource_len(dev, i) == 8 &&
+#endif
(first_port == -1 || (first_port + num_port) == i)) {
num_port++;
if (first_port == -1)
-------- Original Message --------
Subject: Re: pci_resource_end() changed problem with 2.6.14
Date: Fri, 04 Nov 2005 17:56:09 +1100
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Geoff Levand <geoffrey.levand@am.sony.com>
CC: linuxppc64-dev@ozlabs.org
References: <436ADBA7.7030706@am.sony.com>
On Thu, 2005-11-03 at 19:55 -0800, Geoff Levand wrote:
> I found that the serial port probe code in drivers/serial/8250_pci.c
> no longer works properly for ppc64 in 2.6.14. It seems the value
> returned by pci_resource_len() on ppc64 changed from 8 to 16 since
> 2.6.13. I tested on a PC and pci_resource_len() returns 8 as
> expected.
>
> Any help on on where to look for the problem would be appreciated.
>
> Here's the code that hits the problem:
>
> if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
> pci_resource_len(dev, i) == 8 &&
>
> And here are some test results:
Interesting... What does an lspci -vv shows for the BARs of the PCI
card ? Also, what do you have in /proc/device-tree ? What is the
machine precisely ?
2.6.14 now uses the OF device-tree to generate the linux PCI tree
instead of going directly to PCI probing. It's possible that this is
causing your problem if for some reason, the BAR sizing done by OF ends
up being different than what the kernel does ...
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pmac serial_pci_guess_board problem
2005-11-04 21:27 pmac serial_pci_guess_board problem Geoff Levand
@ 2005-11-04 21:47 ` Benjamin Herrenschmidt
2005-11-04 22:50 ` Russell King
0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-04 21:47 UTC (permalink / raw)
To: Geoff Levand; +Cc: rmk+serial, linux-serial
On Fri, 2005-11-04 at 13:27 -0800, Geoff Levand wrote:
> Russell,
>
> I found that the serial port probe code in drivers/serial/8250_pci.c
> no longer works properly for PowerMac G5 in 2.6.14. It seems some new
> code now takes the PCI device info directly from the G5's Open
> Firmware. The trouble is that OF sets the address length to 16 bytes,
> not the expected 8 bytes.
>
> Here's a fix, but I'd be interested to hear your comments.
I wouldn't do the ifdef at all ... Why do we bother testing the size
anyway ? Russell ?
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pmac serial_pci_guess_board problem
2005-11-04 21:47 ` Benjamin Herrenschmidt
@ 2005-11-04 22:50 ` Russell King
2005-11-04 22:53 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Russell King @ 2005-11-04 22:50 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Geoff Levand, linux-serial
On Sat, Nov 05, 2005 at 08:47:40AM +1100, Benjamin Herrenschmidt wrote:
> On Fri, 2005-11-04 at 13:27 -0800, Geoff Levand wrote:
> > Russell,
> >
> > I found that the serial port probe code in drivers/serial/8250_pci.c
> > no longer works properly for PowerMac G5 in 2.6.14. It seems some new
> > code now takes the PCI device info directly from the G5's Open
> > Firmware. The trouble is that OF sets the address length to 16 bytes,
> > not the expected 8 bytes.
> >
> > Here's a fix, but I'd be interested to hear your comments.
>
> I wouldn't do the ifdef at all ... Why do we bother testing the size
> anyway ? Russell ?
That's the expected size of the ports. Remember this is a heuristic
for finding the correct details of the ports. Some cards seem to
have regions of 16 bytes which aren't serial ports.
I'm _very_ nervous about changing this, especially as it pre-dates
my time and you seem to imply that it's an OF problem. Can't it be
fixed up in a PCI quirk?
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pmac serial_pci_guess_board problem
2005-11-04 22:50 ` Russell King
@ 2005-11-04 22:53 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-04 22:53 UTC (permalink / raw)
To: Russell King; +Cc: Geoff Levand, linux-serial
> That's the expected size of the ports. Remember this is a heuristic
> for finding the correct details of the ports. Some cards seem to
> have regions of 16 bytes which aren't serial ports.
>
> I'm _very_ nervous about changing this, especially as it pre-dates
> my time and you seem to imply that it's an OF problem. Can't it be
> fixed up in a PCI quirk?
Could be yes. a ppc64 specific one that re-do the BAR sizing... I wonder
what's up with OF tho ... Maybe Apple's OF can't assign BARs smaller
than 16 bytes ?
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-11-04 22:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-04 21:27 pmac serial_pci_guess_board problem Geoff Levand
2005-11-04 21:47 ` Benjamin Herrenschmidt
2005-11-04 22:50 ` Russell King
2005-11-04 22:53 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).