您的位置:首页 > 其它

PCI设备介绍(一):PCI的一些数字

2013-04-01 09:54 211 查看
lspci命令输出的(XX:YY.Z)三元组分别表示

XX: PCI bus number. A PCI domain can host up to 256 buses

YY: PCI deivce number. Each bus can connect to a maximum of 32 PCI devices. Each device can , in turn, implement up to eight functions represented byZ.

sys文件系统包含了PCI总线和设备的一些信息

/sys/devices/pci0000\:00/0000\:00\:01.0/0000\:01\:00.0/ (注意对冒号转义)

常用的lspci参数,

-t 列出PCI总线和设备的树形结构图

-n 只列数字,不列名字

01:00.0 0200: 8086:10c9 (rev 01)

-nn 既列数字,也列名字

01:00.0 Ethernet controller [0200]: Intel Corporation 82576 Gigabit Network Connection [8086:10c9] (rev 01)

-x 16进制查看PCI配置空间内容

# lspci -x

...

01:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)

00: 86 80 c9 10 07 04 10 00 01 00 00 02 40 00 80 00

10: 00 00 36 f9 00 00 34 f9 81 a8 00 00 00 80 3b f9

20: 00 00 00 00 00 00 00 00 00 00 00 00 e5 19 05 d1

30: 00 00 32 f9 40 00 00 00 00 00 00 00 0f 01 00 00

PCI寄存器时little-endian,所以用od -x看更方便

# od -x /sys/devices/pci0000\:00/0000\:00\:01.0/0000\:01\:00.0/config

0000000 8086 10c9 0407 0010 0001 0200 0040 0080

0000020 0000 f936 0000 f934 a881 0000 8000 f93b

0000040 0000 0000 0000 0000 0000 0000 19e5 d105

0000060 0000 f932 0040 0000 0000 0000 010f 0000

......

这里的8086即为Vendor ID,这个ID标识一个公司,统一维护,可以在http://www.pcidatabase.com/查到,例如0x8086是Intel,0x104c是TI。

10c9是Device ID,82576 Gigabit ET Dual Port Server Adapter,在pcidatabase.com可以查到。

0200是Class code,02开头就代表这是个网络设备。Class code定义在include/linux/pci_ids.h,例如#define PCI_CLASS_NETWORK_ETHERNET 0x0200

其他含义可参考[1]中Table 10.2 PCI Configuration Space Semantics.

[1] 《Essential Linux Device Drivers》

[2] Decoding PCI data and lspci output on Linux hosts, http://prefetch.net/articles/linuxpci.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: