pci_iomap() and pci_ioremap_bar()

Warlich, Christof christof.warlich at siemens.com
Wed Jun 26 03:12:36 EDT 2013


Hi,

can anyone explain when I should use 

void __iomem *regs = pci_iomap(device, barNumber, 0);

and when 

void __iomem *regs = pci_ioremap_bar(device, barNumber);

is more appropriate to map PCI memory?

Furthermore, after the mapping succeeded, when may I
directly access the mapped memory, e.g.:

char firstByte = *regs;

and when should I better use ioread8() instead?:

char firstBype = ioread8(regs);

All listed alternatives from above seems to work equally
well for me (on x86), so I'm curious to learn what might
be the difference. A guess: Does ioread8() work for both
memory mapped _and_ IO mapped registers, while the direct
access only works for the memory mapped case?

Thanks for any clarification. 



More information about the Kernelnewbies mailing list