标准PCI设备都有一个配置寄存器,用来存储各种参数;
/* pci设备配置寄存器 */
struct pci_device_id {
/* 厂商id,设备id */
__u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
/* 子系统厂商id,子系统设备id */
__u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
/* 类,类掩码,使驱动程序可以指定支持某一种pci设备 */
__u32 class, class_mask; /* (class,subclass,prog-if) triplet */
/* 保存于设备相关的私有信息 */
kernel_ulong_t driver_data; /* Data private to the driver */
};
以e100为例,其支持多种设备,不同设备的pci_device_id初始化后存放在e100_id_table[]数组中;
e100_driver操作中的id_table字段会引用该数组;
/* e100的pci设备信息结构列表 */
#define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\
PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \
PCI_CLASS_NETWORK_ETHERNET << , 0xFFFF00, ich }
static const struct pci_device_id e100_id_table[] = {
INTEL_8255X_ETHERNET_DEVICE(0x1029, ),
INTEL_8255X_ETHERNET_DEVICE(0x1030, ),
INTEL_8255X_ETHERNET_DEVICE(0x1031, ),
INTEL_8255X_ETHERNET_DEVICE(0x1032, ),
INTEL_8255X_ETHERNET_DEVICE(0x1033, ),
INTEL_8255X_ETHERNET_DEVICE(0x1034, ),
INTEL_8255X_ETHERNET_DEVICE(0x1038, ),
INTEL_8255X_ETHERNET_DEVICE(0x1039, ),
INTEL_8255X_ETHERNET_DEVICE(0x103A, ),
INTEL_8255X_ETHERNET_DEVICE(0x103B, ),
INTEL_8255X_ETHERNET_DEVICE(0x103C, ),
INTEL_8255X_ETHERNET_DEVICE(0x103D, ),
INTEL_8255X_ETHERNET_DEVICE(0x103E, ),
INTEL_8255X_ETHERNET_DEVICE(0x1050, ),
INTEL_8255X_ETHERNET_DEVICE(0x1051, ),
INTEL_8255X_ETHERNET_DEVICE(0x1052, ),
INTEL_8255X_ETHERNET_DEVICE(0x1053, ),
INTEL_8255X_ETHERNET_DEVICE(0x1054, ),
INTEL_8255X_ETHERNET_DEVICE(0x1055, ),
INTEL_8255X_ETHERNET_DEVICE(0x1056, ),
INTEL_8255X_ETHERNET_DEVICE(0x1057, ),
INTEL_8255X_ETHERNET_DEVICE(0x1059, ),
INTEL_8255X_ETHERNET_DEVICE(0x1064, ),
INTEL_8255X_ETHERNET_DEVICE(0x1065, ),
INTEL_8255X_ETHERNET_DEVICE(0x1066, ),
INTEL_8255X_ETHERNET_DEVICE(0x1067, ),
INTEL_8255X_ETHERNET_DEVICE(0x1068, ),
INTEL_8255X_ETHERNET_DEVICE(0x1069, ),
INTEL_8255X_ETHERNET_DEVICE(0x106A, ),
INTEL_8255X_ETHERNET_DEVICE(0x106B, ),
INTEL_8255X_ETHERNET_DEVICE(0x1091, ),
INTEL_8255X_ETHERNET_DEVICE(0x1092, ),
INTEL_8255X_ETHERNET_DEVICE(0x1093, ),
INTEL_8255X_ETHERNET_DEVICE(0x1094, ),
INTEL_8255X_ETHERNET_DEVICE(0x1095, ),
INTEL_8255X_ETHERNET_DEVICE(0x10fe, ),
INTEL_8255X_ETHERNET_DEVICE(0x1209, ),
INTEL_8255X_ETHERNET_DEVICE(0x1229, ),
INTEL_8255X_ETHERNET_DEVICE(0x2449, ),
INTEL_8255X_ETHERNET_DEVICE(0x2459, ),
INTEL_8255X_ETHERNET_DEVICE(0x245D, ),
INTEL_8255X_ETHERNET_DEVICE(0x27DC, ),
{ , }
};
MODULE_DEVICE_TABLE(pci, e100_id_table);