[PATCH][PPC32] Add setup_indirect_pci_nomap() routine

Mark A. Greer mgreer at mvista.com
Tue Nov 9 10:55:57 EST 2004

Kumar Gala wrote:

> Mark,
> Out of interest, why would we not want to ioremap the cfg addr/data 
> registers?
> - kumar
> On Nov 8, 2004, at 4:56 PM, Mark A. Greer wrote:
>> This patch adds a routine that sets up indirect pci config space access
>> but doesn't ioremap the config space addr/data registers.

You do need them mapped, of course, but:

a) It so happens that on the marvell host bridges those regs are in the 
middle of a larger block that is already ioremapp'd.

b) [Warning: Long story...]  To determine the type of bridge, the code 
has to access a pci cfg register on the bridge so access to those regs 
are necessary no matter what.  However, some platforms that use the 
marvell bridges don't use one or both of the hoses.  We've seen cases 
where if you try to access the pci bus that isn't wired properly, the 
bridge hangs so I can't always use pcibios_alloc_controller() to alloc 
the hose struct (or the pci infrastructure will try to scan the bus & 
hang the bridge).  Instead, in the one routine that gets the bridge 
type, I temporarily use a hose struct alloc'd on the stack and call 
setup_indirect_pci[_nomap]() with it.  Once I've read the bridge type, I 
no longer need that mapping but there is no "remove_indirect_pci()" 
routine to undo the previous setup.  So, worst case, when a platform 
uses both hoses, those regs are mapped once when all the bridge's regs 
are mapped, a second time when the temporary mapping is used, and a 
third time when using a hose struct alloc'd by 
pcibios_alloc_controller().  I end up with two unused mappings.

With some work & ugly code, I could get rid of one extra mapping but not 
both, and making a "nomap" routine just seemed cleaner.  There are 
probably other ppc platforms that could use this as well.


More information about the Linuxppc-dev mailing list