I’m using a PCI-Express board which has a PCIExpress-to-PCI bridge on it. A DSP is connected to the PCI side of the bridge.
I want to access the two address ranges of the DSP (Bar 0 and Bar 1). Bar 1: no problem, Bar 0 failed (read always 0xffffffff) if using QNX 6.3.2.
If using QNX 6.1A: no problem.
Can you run a test on DSP side as well? I mean just to confirm that DSP can actually see the data written through BAR1. My guess is BAR0 doesn’t work either, but you’re lucky to use some unused system memory. Simplest what I would do - make your test app even smaller and do not use pci_attach_device but try using (hard coded for start) phys addresses reported by pci utility. As you may see, pci reports base addr cb800000h and cb000000h. I think, on a PC platform with pci-bios running, pci_attach_device should not change base addresses. However, you got d4800000h and d4000000h, which is suspicious for me. I guess there might be a bug somewhere when dealing with composited 64-bit wide BARs. If I’m right, you may read config space directly (pci_read_config32) to get correct base addresses (instead of hardcoded or passed from pci utility) till QNX address this problem with pci_attach_device.
Sorry, I looked at your files again, and see that your device uses 32-bit address space (no composite 64-bit BARs). Still, I have no idea why pci utility reports different base addresses than pci_attach_device, but I think that’s the problem. I’d rather trust the pci utility.
You found differences in BAR addresses, but that’s a fault of me. I’ve played with PCI boards and restarted pci-bios while creating the attachment. Sorry.
Reading/writing in BAR1 gives no problems. I’ve checked with a JTAG ICE.
BAR0 gives problems.
I found something strange. Our PCI-Express board (Vendor ID: 104c) uses a PCI bridge of PLX (Vendor ID 10b5).
It looks like the Prefetchable Memory Base/Limit values of the bridge are wrong. These registers contain the upper 12 bits of the prefetchable address range.
Memory Base should contain the lowest address, Memory Limit the highest address of the range.
in QNX630:
bridge prefetch. range:
base: 0xd480
limit: 0xd4b0
our board (bar 0 is prefetchable):
bar0: d4800000
in QNX632:
base: 0xf7e0
limit: 0xf7b0 <-??
our board (bar 0 is prefetchable):
bar0: cb800000
The attachment includes the output of pci -v in QNX630 and QNX632.
I don’t know your real problem here, however I had problems writhing a driver in QNX where the card also used a PLX chip. Reason for this so it seemed is that the pci server has trouble finding the right address when a PLX chip is used, have u tried to find the boards manually? I.e by using the pci specs and pci_* and friend functions?
I’ve wrote my ‘own’ attach device routine. Exept I’m also having difficulties trying to read from and write to configuration space. Well reading functions just fine but when I write words to config space and then read the same address, I get a different value. This is the information from config space: (highlighted BAR)
How can I write data to config space without having to worry if everything is written wrong or incomplete? (currently using pci_write_config but doesn’t seem to work)
I/m sorry, maybe I wasn’t very specific. I’m trying to write to de device:
BAR: 0
BaseAddressOffset : 10
IRQOffset : 3C
Base addr value : 0xF7800000
Base addr size : 256
: MEMORY
Cpu base addr value : 0xF7800000
BAR: 1
BaseAddressOffset : 10
IRQOffset : 3C
Base addr value : 0x0000B801
Base addr size : 256
: I/O
Cpu base addr value : 0x0000B800
BAR: 2
BaseAddressOffset : 10
IRQOffset : 3C
Base addr value : 0x0000B401
Base addr size : 256
: I/O
Cpu base addr value : 0x0000B400
BAR: 3
BaseAddressOffset : 10
IRQOffset : 3C
Base addr value : 0xF7000000
Base addr size : 65536
: MEMORY
Cpu base addr value : 0xF7000000
IRQ: 0x0000000B
these last two statements arn’t executed so I used ThreadCtl(_NTO_TCTL_IO, 0) ;
now it works fine. However I don’t know if I’m writing to system RAM or device memory???