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


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值