Ashwin Mylavarapu <firstname.lastname@example.org> wrote:
I’m porting a driver from linux to Qnx. In the driver I need to change
the local address to Pci and vice versa.
Is there any direct function which can do that for me? Or any other
way of doing this?
In fact I’m looking for substitutes of linux virt_to_bus() and
bus_to_virt() call in Qnx.
When you do a pci_attach_device(), it fills in a pci_dev_info structure with
a bunch of information. You want to look at the elements:
The CPU-to-PCI memory translation (pci_addr = cpu_addr - translation).
The translation from the CPU busmaster address to the PCI busmaster
address (pci_addr = cpu_addr + translation).
(On x86 the above will both be 0, on other platforms they may be non-zero.)
Combined with the mem_offset() to get a physical address for memory.
(Note: for DMA operations, you need to specifically allocate physically
contiguous memory, using mmap(), rather than just malloc()ing it, since
malloc()ed memory may not be physically contiguous.)
QNX Training Services