Charlie Powell wrote:
We are using QNX 4.25 on a Kontron SBC that includes a 21554 PCI interface
chip. Part of the memory local to the Kontron SBC running QNX needs to be
able to reserve a chunk of memory so that we can map it to PCI memory space.
This way, other SBCs on the PCI backplane can access the memory of the
For example, upon power up the PCI BIOS assigns the Kontron board to PCI
address 0xbf000000. Now other SBCs on the backplane can access the Kontron
board via PCI address 0xbf000000. By default, the Kontron SBC leaves the map
value as 0x0000000 and consequently a SBC on the PCI can read/write PCI
address 0xbf000000 and access Kontron local address 0x0000000.
We need to create a QNX program to manage a local memory space we want to
map to the PCI but we don’t know how to do this. Please consider the
following program requirements and post your suggestions to this news group.
Firstly, I have not done this, but it seems
You want your “manager” program, to
allocate some memory and program the 21554
to map PCI address bf000000 to the corresponding
physical memory on the Kontron board.
The “manager” program will then
communicate data into or out of this
memory using standard QNX message passing.
- Reserve a block of local memory and determine it’s absolute address so
that absolute address can be used in the PCI to local memory map.
This is the only tricky bit (getting the
physical address of the memory your manager
allocated). Fortunately, there is a knowledge
- Ensure that block of memory is not deallocated or moved or otherwise
swapped out by QNX when the managing process is idle.
QNX 4 will not change your vm mappings.
If you want to be sure, you could mmap()
the memory (nothing fancy just -
mmap(0, len, R/W/NO_CACHE, MAP_PRIVATE, fd, 0)).
You can still use the pointer you get from
mmap() as an arg to vtop().
Once you have allocated your memory and
determined its physical address, you simply
need to tell the 21554 to map PCI address
bf000000 to the physical address you obtained
It should be that simple. Now your QNX apps
can read/write the PCI mapped memory via a message
protocol (you could make the “manager” a resource
manager and provide a posix open/read/write
note: If you wanted to simply make the memory
available as a shared object to other QNX
processes (rather than establish a formal
interface), you could mmap(… MAP_SHARED), instead
of PRIVATE (in which case your "manager"s only job
is to alloc the memory, and program the 21554).