Re: pci_iomap() and pci_ioremap_bar()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



AFAIK, pci_ioremap_bar api provides an error-proof way (relative to pci_ioremap) for PCI memory remap.

After the mapping is successful, in case you are writing a portable code, use ioread8 api which provides platform abstraction to the re mapped registers.

Hope that helps.

BR,
Jayesh 


On Wed, Jun 26, 2013 at 12:42 PM, Warlich, Christof <christof.warlich@xxxxxxxxxxx> wrote:
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.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux