Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I've written functions to read the PCI configuration space, but I can't seem to find any sources to write it. I looked at the Linux source, and it does some strange thing with a structure, I checked Google, and it only has advice on how to do it with existing drivers, and there's nothing in the wiki on it. I tried this:
Assuming you have your port numbers correct, and the range of values you are passing is valid. The only problem with that code is the value you are writing is being passed as a short (which is usually 16 bits), it should be a long (or preferably something like uint32_t)