Writing PCI Config space?
Posted: Sat Apr 02, 2011 7:09 pm
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:
but it didn't work. Any advice?
Code: Select all
void PCIConfigWriteWord(unsigned long bus, unsigned long dev, unsigned long func, unsigned long reg, unsigned short val)
{
/* Create and write out config address */
outd(PCI_CONFIG_ADDR, (unsigned long int)((bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) | ((unsigned int)0x80000000)));
/* Write out the data */
outd(PCI_DATA_ADDR, val);
return;
}