“cat / proc / bus / pci / devices”的前几个字段是可以理解的.
字段1 – BusDevFunc
字段2 – 供应商ID设备标识
字段3 – 中断线
字段4 – BAR 0
和其余的BAR寄存器(0-5)之后.
打印出BAR寄存器后,其他字段是什么?具体来说,打印出PCI配置空间寄存器(偏移量)?
解决方法
这是内核中相应的代码:
static int show_device(struct seq_file *m,void *v) { const struct pci_dev *dev = v; const struct pci_driver *drv; int i; if (dev == NULL) return 0; drv = pci_dev_driver(dev); seq_printf(m,"%02x%02x\t%04x%04x\t%x",dev->bus->number,dev->devfn,dev->vendor,dev->device,dev->irq); /* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */ for (i=0; i<7; i++) { resource_size_t start,end; pci_resource_to_user(dev,i,&dev->resource[i],&start,&end); seq_printf(m,"\t%16llx",(unsigned long long)(start | (dev->resource[i].flags & PCI_REGION_FLAG_MASK))); } for (i=0; i<7; i++) { resource_size_t start,dev->resource[i].start < dev->resource[i].end ? (unsigned long long)(end - start) + 1 : 0); } seq_putc(m,'\t'); if (drv) seq_printf(m,"%s",drv->name); seq_putc(m,'\n'); return 0; }
在IRQ之后,它似乎是与前6个资源区域的标志相结合的起始地址,其后是这些资源区域的长度,后面是已声明设备的驱动程序的名称.