每种类的PCI设备都可以用结构类型pci_dev来描述。更为准确地说,应该是每一个PCI功能,即PCI逻辑设备都唯一地对应有一个pci_dev设备描述符。该数据结构的部分定义如下(include/linux/pci.h):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| struct pci_dev {
struct list_head bus_list;
struct pci_bus *bus;
struct pci_bus *subordinate;
void *sysdata;
struct proc_dir_entry *procent;
unsigned int devfn;
unsigned short vendor;
unsigned short device;
unsigned short subsystem_vendor;
unsigned short subsystem_device;
unsigned int class;
u8 hdr_type;
u8 rom_base_reg;
struct pci_driver *driver;
u64 dma_mask;
pci_power_t current_state;
struct device dev;
unsigned int irq;
struct resource resource[DEVICE_COUNT_RESOURCE];
int cfg_size;
unsigned int transparent:1;
unsigned int multifunction:1;
unsigned int is_busmaster:1;
unsigned int no_msi:1;
unsigned int block_ucfg_access:1;
u32 saved_config_space[16];
struct bin_attribute *rom_attr;
int rom_attr_enabled;
struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE];
};
|