pmac serial_pci_guess_board problem
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
drivers/serial/8250_pci.c +4 -0
@@ -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 && +#elsepci_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 <[email protected]>
To: Geoff Levand <[email protected]>
CC: [email protected]
References: <[email protected]>
Quoted 6 lines · Geoff Levand
I found that the serial port probe code in
drivers/serial/8250_pci.cno longer works properly for ppc64 in 2.6.14. It seems the value returned bypci_resource_len()on ppc64 changed from 8 to 16 since 2.6.13. I tested on a PC andpci_resource_len()returns 8 as expected.
Quoted 8 lines
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.
Quoted 9 lines · Geoff Levand
Russell,
I found that the serial port probe code in
drivers/serial/8250_pci.cno 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.
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 8 lines · Geoff Levand
Russell,
I found that the serial port probe code in
drivers/serial/8250_pci.cno 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.
Quoted 4 lines
Quoted 1 line
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?
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Quoted 8 lines
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.