mpc8541 pci1 ioport allocation address space problem
Wang Jian
lark at linux.net.cn
Sat Sep 20 21:16:25 EST 2008
Hi,
Here I have a 8541 dev board, with 2 e1000 attached to pci0 and a
homebrewed addon board inserted into pci1. I am trying to make it work
under 2.6.26-rc8 (2.6.26 broken so I am working at rc8).
The ioports allocation reads
$ cat /proc/ioports
00000000-000fffff : /pci at e0008000
00001000-0000103f : 0000:00:0a.0
00001040-0000107f : 0000:00:0b.0
ffefe000-ffffdfff : /pci at e0009000
ffeff000-ffeff00f : 0001:01:0a.0
ffeff010-ffeff01f : 0001:01:0b.0
ffeff020-ffeff02f : 0001:01:0c.0
ffeff030-ffeff03f : 0001:01:0d.0
The port allocation for pci1 looks ridiculous. The addon board doesn't work.
After poking around, I find pci_process_bridge_OF_ranges() in
arch/powerpc/kernel/pci-common.c
--snip--
if (primary)
isa_io_base = (unsigned long)hose->io_base_virt;
--snip--
then fixup_resource(), _IO_BASE = isa_io_base. fix_resource will use
isa_io_base as base address to assign io port address space.
This is reasonable, but on my board, pci1's hose->io_base_virt is
smaller than pci0's. This lead to
[ 0.064214] PCI:0000:00:0a.0 Resource 4
0000000000001000-000000000000103f [20101] fixup...
[ 0.064224] fixup_resource() offset=00000000, io_base_virt=fdeb4000,
_IO_BASE=fdeb4000, io_base_phys=e2000000
[ 0.064232] PCI:0000:00:0a.0 0000000000001000-000000000000103f
[ 0.065129] PCI:0001:01:0a.0 Resource 2
0000000000001000-000000000000100f [20101] fixup...
[ 0.065139] fixup_resource() offset=ffefe000, io_base_virt=fddb2000,
_IO_BASE=fdeb4000, io_base_phys=e3000000
[ 0.065147] PCI:0001:01:0a.0 00000000ffeff000-00000000ffeff00f
offset = fddb2000 - fdeb4000 = ffefe000
So far, I think the workaround is to replace the code above with
--snip--
if (!isa_io_base)
isa_io_base = (unsigned long)hose->io_base_virt;
else if ((unsigned long)hose->io_base_virt < isa_io_base)
isa_io_base = (unsigned long)hose->io_base_virt;
--snip--
Then ioport allocation reads (But I haven't test if it works)
$ cat /proc/ioports
00000000-000fffff : /pci at e0009000
00001000-0000100f : 0001:01:0a.0
00001010-0000101f : 0001:01:0b.0
00001020-0000102f : 0001:01:0c.0
00001030-0000103f : 0001:01:0d.0
00102000-00201fff : /pci at e0008000
00103000-0010303f : 0000:00:0a.0
00103040-0010307f : 0000:00:0b.0
Can someone gives a better generic fix for this?
PS: I attach the kernel log (without workaround) for reference. I added
some printk code.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ppc_pci.txt
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20080920/35ae60fc/attachment.txt>
More information about the Linuxppc-dev
mailing list