如何在CentOS 7和RedHat Enterprise Linux 7上查看PCI设备信息

时间:2020-01-09 10:39:41  来源:igfitidea点击:

CentOS/RHEL 7 报错lspci: command not found,如何解决?

如何在CentOS/RHEL 7上查看PCI设备信息?

lspci命令用于显示有关由Linux操作系统支持的服务器或台式机或笔记本电脑中所有PCI总线和设备的详细信息。
它基于通用的可移植库libpci,该库可访问各种操作系统上的PCI配置空间。
让我们看看如何使用各种命令来查看CentOS 7和RedHat Enterprise Linux 7(RHEL 7)上的PCI设备信息。

为什么会出现-bash:lspci:命令未找到错误?

以下错误表明在安装CentOS服务器时未将lspci命令安装在系统上或已将其删除:
如何修复bash: lspci: command not found问题

在CentOS 7和RedHat Enterprise Linux 7上查看PCI设备信息的修复程序

只需在CentOS/RHEL 7服务器上安装pciutils软件包:

# yum install pciutils

更新PCI ID列表

要下载PCI ID列表的新版本,请执行:

# update-pciids

如何列出所有PCI设备?

执行以下命令以在CentOS 7或RHEL 7上查看PCI设备信息:

# lspci
# lspci [options]
# lspci
# lspci | more
# lspci -t -v

如何在CentOS 7/RHEL 7上查看wifi PCI设备信息

运行lspci命令并使用grep命令或egrep命令过滤掉信息:

lspci | egrep -i 'wifi|wireless'
`04:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)`
# lspci | egrep -i 'eth|network|wifi|wireless'

在CentOS 7或RedHat Enterprise Linux 7上找到wifi或以太网驱动程序名称

lspci -s 04:00.0 -v

输出示例:

04:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)
	Subsystem: Intel Corporation Dual Band Wireless-AC 7260
	Flags: bus master, fast devsel, latency 0, IRQ 57
	Memory at c1500000 (64-bit, non-prefetchable) [size=8K]
	Capabilities: [c8] Power Management version 3
	Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [40] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [140] Device Serial Number 7c-5c-f8-ff-ff-8e-33-a2
	Capabilities: [14c] Latency Tolerance Reporting
	Capabilities: [154] Vendor Specific Information: ID=cafe Rev=1 Len=014 <?>
	Kernel driver in use: iwlwifi
	Kernel modules: iwlwifi

更多信息

这是lspci手册页中所有选项的列表:

Basic display modes:
-mm		Produce machine-readable output (single -m for an obsolete format)
-t		Show bus tree
 
Display options:
-v		Be verbose (-vv for very verbose)
-k		Show kernel drivers handling each device
-x		Show hex-dump of the standard part of the config space
-xxx		Show hex-dump of the whole config space (dangerous; root only)
-xxxx		Show hex-dump of the 4096-byte extended config space (root only)
-b		Bus-centric view (addresses and IRQ's as seen by the bus)
-D		Always show domain numbers
 
Resolving of device ID's to names:
-n		Show numeric ID's
-nn		Show both textual and numeric ID's (names & numbers)
-q		Query the PCI ID database for unknown ID's via DNS
-qq		As above, but re-query locally cached entries
-Q		Query the PCI ID database for all ID's via DNS
 
Selection of devices:
-s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]	Show only devices in selected slots
-d [<vendor>]:[<device>]			Show only devices with specified ID's
 
Other options:
-i <file>	Use specified ID database instead of /usr/share/hwdata/pci.ids
-p <file>	Look up kernel modules in a given file instead of default modules.pcimap
-M		Enable `bus mapping' mode (dangerous; root only)
 
PCI access options:
-A <method>	Use the specified PCI access method (see `-A help' for a list)
-O <par>=<val>	Set PCI access parameter (see `-O help' for a list)
-G		Enable PCI access debugging
-H <mode>	Use direct hardware access (<mode> = 1 or 2)
-F <file>	Read PCI configuration dump from a given file