PCI设备上有三种地址空间:memory locations, I/O ports and configuration registers.I/O空间、存储空间和的配置空间。
I/O空间和存储空间由同一条PCI总线的的所有设备共享,例如当你存取一个内存空间时,同一条总线上所有的设备都可以看到总线周期信号等。 而配置空间则采用geographical addressing(地理位置寻址),所以configuration queries每次只会寻址一个slot,不会存在冲突。 The configuration sapce exploits geographical addressing, configuration queries address only one slot at a time, so they never collide.
Four bytes of the configuration space hold a unique function ID, the VendorID and DeviceID pair, so the driver can use it to identify the device.
In Linux, there is a structure named pci_device_id, the driver have to fill in the types of device which it supported, and it is exported to user space to allow the hotplug and module loading system know what moudle works with hardware devices.
Specification notes: 1. PCI registers are always little-endian.
Code notes:
int pci_proc_attach_device(struct pci_dev *dev) exported info to /proc