Problems accessing PCI device

Hi all.

I am testing a PCI card I’ve designed in a x86 machine, running under QNX 6.1. The device is detected by the PCI BIOS, and its resources allocated as I wanted.

After that, I can access the PCI configuration registers, located in memory space, using the pci_* functions provided by the QNX Development Toolkit, but (this is my problem) when I try to access the device’s registers, located in I/O space, using in*() functions then the computer get hung and doesn’t operate anymore, the only thing I can do then is to restart the computer.

I set I/O privilege with ThreadCtl() so this is not the reason.

Does anybody know what can be happening?

Any suggestion on inquiring what’s happening?

Thank you in advance.

Did you mmap_device_io ?

To troubleshoot this with software, I would verify every value and function you are using is correct,including there not being an interaction with an earlier access to the card. And since the problem is showing up on first IN/OUT instruction then you definitly should verify the i/o location is correct.

Secondly, your hardware is clearly in question too. Finding a specialized tool for the job maybe a good idea. The “pci” command will atleast list the cards existence and may help you identify bad config values.

Yes, I’ve tried using mmap_device_io, and it doesn’t work, but I also read that you don’t need to use this function in x86 machines, and can use directly in*() or out*() instructions.

Thanks for your reply “rgallen”.

I’ve checked this values but those seems to be correct, and an evidence is the fact that the PCI BIOS allocated the resources in the way I predicted. Also I have checked this values using “pci -v” utility (that you mentioned above), which display all pci devices and the configuration register values, and the values of the PCIBAR’s were correct in the space used (I/O) and in the length (16 bytes), and this space appears as “enabled”.

I used the pci_attach() and pci_attach_device(), but I assured to use pci_detach() and pci_detach_device() before attempting to access the registers of the device.

Then I throw a new question:

It’s possible that PCI BIOS, for any reason, can block the access to any device I/O space?

Thank you “evanh” for your help.