[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Work on PCI support :-)
On Mon, 30 May 2011 23:13:40 +0200
Rados?aw Kujawa <radoslaw.kujawa%c0ff33.net@localhost> wrote:
> In p5pb driver I created a bus_space_tag for a PCI memory area like
> sc->pci_mem_area.base = (bus_addr_t) zbusmap(
> (void *) 0xe0000000, 0x02000000);
> sc->pci_mem_area.absm = &amiga_bus_stride_1;
> This is area is mapped into KVA at 0x268a000, all seems to be cool at
> this point. The tag is passed on to MI code.
Was this memory range considered in amiga_init.c, and added to ZBUSAVAIL?
Otherwise you can get a problem running out of KVA space.
> During pm2fb attachment, PCI MI code tries to map memory regions
> using information acquired from BARs. Permedia 2 registers are
> located at PA 0xe1000000, 128kB wide. PCI MI code (pci_mapreg_submap
> in pci_map.c) calls bus_space_map like this:
> bus_space_map(pci_mem_area, 0xe1000000, 20000 0);
> Where pci_mem_area is the exact same tag I created earlier in p5pb.
> That's no good, because pci_mem_area is already pointing to
> 0x268a000, which is mapped PA 0xe0000000. So, if I understand
> correctly, any read or write using handle created by this
> bus_space_map is hitting 0x268a000 + 0xe1000000, which leads to a MMU
True. Your PCI bus space doesn't work that way.
> In all amiga drivers I've seen, the second argument to bus_space_map
> was always an offset (from base specified in MD bus_space_tag).
AFAIK this is absolutely normal. When calling bus_space_map() you will
always pass an offset, relative to the start address of your bus.
0xe1000000 is also an offset, because the PCI bus usually starts at 0x00000000
and is 4GB large. So correct would have been to define your PCI bus space tag
with a base of 0. But the problem is that you cannot map 4GB of memory.
There may be several solutions to this problem. You could add a new flag
or offset field to our bus space tag to handle this special situation.
Or you could delay the zbusmap() until bus_space_map() is called.
Or maybe you should run a new PCI bus enumeration and reassign the BARs
to reflect the real offset.
But I'm also no expert in this topic.
Main Index |
Thread Index |