GNU/Linux >> Linux の 問題 >  >> Linux

7 PCI バス ハードウェア デバイス情報を取得するための Linux lspci コマンドの例

lspci はリスト pci の略です。このコマンドは「ls」+「pci」と考えてください。

これにより、サーバー内のすべての PCI バスに関する情報が表示されます。

バスに関する情報を表示するだけでなく、PCI および PCIe バスに接続されているすべてのハードウェア デバイスに関する情報も表示されます。

たとえば、イーサネット カード、RAID コントローラ、ビデオ カードなどに関する情報が表示されます。

lspci ユーティリティは pciutils パッケージの一部です。

pciutilis がない場合は、以下に示すようにシステムにインストールしてください。

# yum install pciutils

1.デフォルトの使用法

デフォルトでは、以下に示すようにすべてのデバイス情報が表示されます。最初のフィールドは、次の形式のスロット情報です:[domain:]bus:device.function

この例では、すべてのドメインが 0 であるため、lspci はドメインを表示しません。

# lspci
00:00.0 Host bridge: Intel Corporation 5500 I/O Hub to ESI Port (rev 13)
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13)
00:09.0 PCI bridge: Intel Corporation 7500/5520/5500/X58 I/O Hub PCI Express Root Port 9 (rev 13)
00:14.0 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub System Management Registers (rev 13)
00:14.1 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers (rev 13)
00:14.2 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub Control Status and RAS Registers (rev 13)
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 02)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801IB (ICH9) 2 port SATA Controller [IDE mode] (rev 02)
01:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
01:00.1 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
06:03.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a)

注:以下のすべての例では、上記のリストからいくつかのデバイスを選択して、部分的な出力のみを表示します。

2. PCI 情報を別の形式でダンプ

lspci コマンドの出力をシェル スクリプトに渡したい場合は、以下に示すように -m オプション (または -mm オプション) を使用できます。

このオプションは、サブシステム情報を表示する場合にも役立ちます。たとえば、RAID コントローラの場合、デフォルトの出力は、LSI Logic RAID コントローラを使用していることだけを示しています。ただし、次の出力は、DELL PERC H700 統合 RAID コントローラー システムであるサブシステムを表示します。

# lspci -m
00:00.0 "Host bridge" "Intel Corporation" "5500 I/O Hub to ESI Port" -r13 "Dell" "PowerEdge R610 I/O Hub to ESI Port"
00:09.0 "PCI bridge" "Intel Corporation" "7500/5520/5500/X58 I/O Hub PCI Express Root Port 9" -r13 "" ""
00:14.0 "PIC" "Intel Corporation" "7500/5520/5500/X58 I/O Hub System Management Registers" -r13 "" ""
00:1a.0 "USB controller" "Intel Corporation" "82801I (ICH9 Family) USB UHCI Controller #4" -r02 "Dell" "PowerEdge R610 USB UHCI Controller"
00:1f.0 "ISA bridge" "Intel Corporation" "82801IB (ICH9) LPC Interface Controller" -r02 "Dell" "PowerEdge R610 82801IB (ICH9) LPC Interface Controller"
00:1f.2 "IDE interface" "Intel Corporation" "82801IB (ICH9) 2 port SATA Controller [IDE mode]" -r02 -p8f "Dell" "PowerEdge R610 SATA IDE Controller"
01:00.0 "Ethernet controller" "Broadcom Corporation" "NetXtreme II BCM5709 Gigabit Ethernet" -r20 "Dell" "PowerEdge R610 BCM5709 Gigabit Ethernet"
03:00.0 "RAID bus controller" "LSI Logic / Symbios Logic" "MegaRAID SAS 2108 [Liberator]" -r05 "Dell" "PERC H700 Integrated"
06:03.0 "VGA compatible controller" "Matrox Electronics Systems Ltd." "MGA G200eW WPCM450" -r0a "Dell" "PowerEdge R610 MGA G200eW WPCM450"

3.ツリー形式で出力

-t オプションは、以下に示すように、バスに関する情報と、それらのバスにデバイスがどのように接続されているかを示すツリー形式で出力を表示します。出力は数値 ID のみを使用します。

# lspci -t
-[0000:00]-+-00.0
           +-01.0-[01]--+-00.0
           |            \-00.1
           +-03.0-[02]--+-00.0
           |            \-00.1
           +-07.0-[04]--
           +-09.0-[05]--
           +-14.0
           +-14.1
           +-1c.0-[03]----00.0
           +-1d.0
           +-1e.0-[06]----03.0
           +-1f.0

4.詳細なデバイス情報

特定のデバイスの詳細を調べたい場合は、-v を使用して詳細情報を取得します。これにより、すべてのデバイスに関する情報が表示されます。このコマンドの出力は非常に長くなるため、下にスクロールして適切なセクションを表示する必要があります。

詳細レベルを追加するには、-vv または -vvv を使用できます。

次の例では、RAID コントローラ デバイスのみを出力しています。

# lspci -v
 03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
        Subsystem: Dell PERC H700 Integrated
        Flags: bus master, fast devsel, latency 0, IRQ 16
        I/O ports at fc00 [size=256]
        Memory at df1bc000 (64-bit, non-prefetchable) [size=16K]
        Memory at df1c0000 (64-bit, non-prefetchable) [size=256K]
        Expansion ROM at df100000 [disabled] [size=256K]
        Capabilities: [50] Power Management version 3
        Capabilities: [68] Express Endpoint, MSI 00
        Capabilities: [d0] Vital Product Data
        Capabilities: [a8] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [c0] MSI-X: Enable+ Count=15 Masked-
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [138] Power Budgeting <?>
        Kernel driver in use: megaraid_sas
        Kernel modules: megaraid_sas

5.出力にデバイス コードを表示する

PCI ベンダー コードとデバイス コードを数字のみで表示する場合は、-n オプションを使用します。これは、数値に対応する値を取得するために PCI ファイルを検索しません。

# lspci -n
01:00.1 0200: 14e4:1639 (rev 20)
02:00.0 0200: 14e4:1639 (rev 20)
02:00.1 0200: 14e4:1639 (rev 20)
03:00.0 0104: 1000:0079 (rev 05)
06:03.0 0300: 102b:0532 (rev 0a)

説明と番号の両方を表示したい場合は、以下に示すようにオプション -nn を使用してください。

# lspci -nn
01:00.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet [14e4:1639] (rev 20)
03:00.0 RAID bus controller [0104]: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] [1000:0079] (rev 05)
06:03.0 VGA compatible controller [0300]: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 [102b:0532] (rev 0a)
..

6.特定のデバイスを検索

domain:bus:slot.func 形式でスロット番号がわかっている場合は、以下に示すように特定のデバイスを照会できます。次の例では、ドメイン番号を指定しませんでした。これは 0 であるため、省略できます。

# lspci -s 03:00.0
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)

vendor:device 形式のデバイス番号がわかっている場合は、以下に示すように特定のデバイスを照会できます。

# lspci -d 1000:0079
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)

ベンダー ID またはデバイス ID のいずれかしかわかっていない場合は、他の ID を省略できます。たとえば、次のコマンドはどちらも上記と同じ出力を返します。

lspci -d :0079
lspci -d 1000:

7.カーネル ドライバーの表示

これは、特定のデバイスの操作を処理するカーネル モジュールの名前を知りたい場合に非常に役立ちます。このオプションは、カーネル 2.6 バージョン以降でのみ機能することに注意してください。

# lspci -k
00:1f.2 IDE interface: Intel Corporation 82801IB (ICH9) 2 port SATA Controller [IDE mode] (rev 02)
        Subsystem: Dell PowerEdge R610 SATA IDE Controller
        Kernel driver in use: ata_piix
        Kernel modules: ata_generic, pata_acpi, ata_piix
02:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
        Subsystem: Dell PowerEdge R610 BCM5709 Gigabit Ethernet
        Kernel driver in use: bnx2
        Kernel modules: bnx2
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
        Subsystem: Dell PERC H700 Integrated
        Kernel driver in use: megaraid_sas
        Kernel modules: megaraid_sas

Linux
  1. Linux での sa コマンドの例

  2. Linux での ac コマンドの例

  3. Linux での df コマンドの例

  1. Linux での lvmdump コマンドの例

  2. Linux での rm コマンドの例

  3. Linux での du コマンドの例

  1. 7 Linux df コマンドの例

  2. 8 Linux TR コマンドの例

  3. Linux での ps コマンドの例