On Sun, Sep 19, 2010 at 04:39:44PM +0200, Arnd Bergmann wrote: > On Sunday 19 September 2010 16:07:02 Mike Rapoport wrote: > > As far as I understand, the IO space should be mapped prior to use and __io > > should return the virtual address. > > That's right. You already map all the PCI registers including the I/O port > mapping at initialization time, but you must not attempt to access these > during boot before that time. Yes. __io() takes the IO port address, and returns a virtual address for the inb() et.al. macros to deference to perform the actual access. So, for example if you have a PCI serial card inserted which appears at 0x3f8, then inb(0x3f8) should access the first register on the PCI serial card. As inb(0x3f8) equates to __raw_readb(__io(0x3f8)), __io(0x3f8) must return the virtual address to access that port. Eg, on DC21285 (footbridge) systems, the PCI IO window is at 0x7c000000 physical, mapped into 0xff000000 virtual. So __io(0x3f8) translates to 0xff0003f8 virtual, which hits 0x7c0003f8 physical, and 0x3f8 as an IO access on the PCI bus. Things become a little more complicated when you have PCMCIA cards with separate IO regions, as on SA11x0 and PXA systems. These don't tend to have PCI, so we adopted there to have __io() do a 1:1 translation, and arrange for the "bus IO" address to be the actual virtual address. -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html