PCI及PCIE配置空间的读取有两种方式:
1.通过IO端口0xCF8/CFC
_outpd(0xCF8,(1 << 31) | (Bus << 16) | (Dev << 11) | (Fun << 8) | Reg )
然后就可以通过读取0xCFC-0xCFF来获取BIT0~BIT32的值
_inp(0xCFC)
_inp(0xCFD)
_inp(0xCFE)
_inp(0xCFF)
_inpw(0xCFC)
_inpw(0xCFE)
_inpd(0xCFC)
2.通过内存地址直接读取
Intel Chipset的PciexBaseAddress一般从Bus0 Dev0 Fun0 Reg60~64读取
address = PciexBaseAddress | (Bus << 20) | (Dev << 15) | (Fun << 12) | Reg;