CentOS下lspci命令詳解整理

來源:互聯網
上載者:User

CentOS下lspci命令詳解整理

說明:
lspci是一個用來顯示系統中所有PCI匯流排裝置或串連到該匯流排上的所有裝置的工具。

參數:

-v使得 lspci 以冗餘模式顯示所有裝置的詳細資料。-vv使得 lspci 以過冗餘模式顯示更詳細的資訊 (事實上是 PCI 裝置能給出的所有東西)。這些資料的確切意義沒有在此手冊頁中解釋,如果你想知道更多,請參照 /usr/include/linux/pci.h 或者 PCI 規範。-n以數字形式顯示 PCI 生產廠商和裝置號,而不是在 PCI ID 資料庫中尋找它們。-x以十六進位顯示 PCI 配置空間 (configuration space) 的前64個位元組映像 (標準頭部資訊)。此參數對調試驅動和 lspci 本身很有用。-xxx以十六進位顯示所有 PCI 配置空間的映像。此選項只有 root 可用,並且很多 PCI 裝置在你試圖讀取配置空間的未定義部分時會崩潰 (此操作可能不違反PCI標準,但是它至少非常愚蠢)。-b以匯流排為中心進行查看。顯示所有 IRQ 號和記憶體地址,就像 PCI 匯流排上的卡看到的一樣,而不是核心看到的內容。-t以樹形方式顯示包含所有匯流排、橋、裝置和它們的串連的圖表。-s [[<bus>]:][<slot>][.[<func>]]僅顯示指定匯流排、插槽上的裝置或裝置上的功能塊資訊。裝置地址的任何部分都可以忽略,或以「*」代替 (意味著所有值)。所有數字都是十六進位。例如:「0:」指的是在0號匯流排上的所有裝置;「0」指的是在任意匯流排上0號裝置的所有功能塊;「0.3」選擇 了所有匯流排上0號裝置的第三個功能塊;「.4」則是只列出每一裝置上的第四個功能塊。-d [<vendor>]:[<device>]只顯示指定生產廠商和裝置識別碼 的裝置。 這兩個 ID 都以十六進位表示,可以忽略或者以「*」代替 (意味著所有值)。-i <file>使用 <file> 作為 PCI ID 資料庫而不是使用預設的 /usr/share/hwdata/pci.ids。-p <dir>使用 <dir> 作為包含 PCI 匯流排資訊的目錄而不是使用預設的目錄 /proc/bus/pci。-m以機器可讀的方式轉儲 PCI 裝置資料 (支援兩種模式:普通和冗餘),便於稿本解析。-M使用匯流排映射模式,這種模式對匯流排進行全面地掃描以查明匯流排上的所有裝置,包括配置錯誤的橋之後的裝置。請注意,此操作只應在調試時使 用,並可能造成系統崩潰 (只在裝置有錯誤的時候,但是不幸的是它們存在),此命令只有 root 可以使用。同時,在不直接接觸硬體的 PCI 訪問模式中使用 -M 參數沒有意義,因為顯示的結果 (排除 lspci 中的 bug 的影響) 與普通的列表模式相同。--version顯示 lspci 的版本。這個選項應當單獨使用。PCILIB 選項 PCILIB OPTIONSPCI 工具使用 PCILIB (一種可移植的庫,提供平台獨立的函數來訪問 PCI 配置空間)來和PCI卡互動。下面的選項用來控制庫參數,特別是所用訪問模式的指定。預設情況下,PCILIB 使用第一種可用的訪問模式,不會顯示任何調試資訊。每一個開關選項都列出了一組它所支援的硬體/軟軟體列表。-P <dir>使用 linux 2.1 風格的配置,直接存取目錄 <dir> 而非 /proc/bus/pci 目錄。(只能在linux 2.1或以上版本中使用)-H1通過 Intel 架構 1 來實現直接硬體訪問。(只能用於 i386 及其相容機)-H2通過Intel 架構2來實現直接硬體訪問。警告:此模式只能定址任何匯流排上的前16個裝置,並且在很多情況下相當不可靠。(只能用於 i386 及其相容機)-S使用 PCI 系統調用訪問。(只能用於 Alpha 和 Ultra-Sparc 上的 Linux)-F <file>從所給的包含 lspci -x命令輸出的檔案中擷取相關資訊。這在分析使用者提交的錯誤報表時很有用,因為你可以用任何方式來顯示硬體配置資訊而無需為了擷取更多資訊打擾使用者。(可用於所有系統)-G增加庫的調試等級。(可用於所有系統)


執行個體:
執行個體1:不必加上任何選項,就能夠顯示出目前的硬體配備

# lspci00:00.0 Host bridge: Intel Corporation 3200/3210 Chipset DRAM Controller  //主板晶片00:19.0 Ethernet controller: Intel Corporation 82566DM-2 Gigabit Network Connection (rev 02)00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02)00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 02)00:1a.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 02)00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 02)  //USB控制器00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 02)  //介面插槽00:1c.4 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 (rev 02)00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 02)00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 02)00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 02)00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 02)00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller (rev 02)00:1f.2 IDE interface: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 4 port SATA IDE Controller (rev 02)00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)00:1f.5 IDE interface: Intel Corporation 82801I (ICH9 Family) 2 port SATA IDE Controller (rev 02)02:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G200e [Pilot] ServerEngines (SEP1) (rev 02)  //顯卡03:02.0 Ethernet controller: Intel Corporation 82541GI Gigabit Ethernet Controller (rev 05)  //網卡


執行個體2:查看一般詳細資料

# lspci -v00:00.0 Host bridge: Intel Corporation 3200/3210 Chipset DRAM Controller        Subsystem: Intel Corporation Unknown device 34d0        Flags: bus master, fast devsel, latency 0        Capabilities: [e0] Vendor Specific Information00:19.0 Ethernet controller: Intel Corporation 82566DM-2 Gigabit Network Connection (rev 02)        Subsystem: Intel Corporation Unknown device 34d0        Flags: bus master, fast devsel, latency 0, IRQ 50        Memory at e1a00000 (32-bit, non-prefetchable) [size=128K]        Memory at e1a20000 (32-bit, non-prefetchable) [size=4K]        I/O ports at 20e0 [size=32]        Capabilities: [c8] Power Management version 2        Capabilities: [d0] Message Signalled Interrupts: 64bit+ Queue=0/0 Enable+        Capabilities: [e0] #13 [0306]


執行個體3:查看網卡詳細資料

# lspci -s 03:02.0 -vv  //-s後面接的是每個裝置的匯流排、插槽與相關函數功能03:02.0 Ethernet controller: Intel Corporation 82541GI Gigabit Ethernet Controller (rev 05)        Subsystem: Intel Corporation Unknown device 34d0        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr+ Stepping- SERR+ FastB2B-        Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <tabort- <mabort- >SERR- <perr-        Latency: 32 (63750ns min), Cache Line Size: 64 bytes        Interrupt: pin A routed to IRQ 209        Region 0: Memory at e1920000 (32-bit, non-prefetchable) [size=128K]        Region 1: Memory at e1900000 (32-bit, non-prefetchable) [size=128K]        Region 2: I/O ports at 1000 [size=64]        Expansion ROM at fffe0000 [disabled] [size=128K]        Capabilities: [dc] Power Management version 2                Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)                Status: D0 PME-Enable- DSel=0 DScale=1 PME-        Capabilities: [e4] PCI-X non-bridge device                Command: DPERE- ERO+ RBC=512 OST=1                Status: Dev=00:00.0 64bit- 133MHz- SCD- USC- DC=simple DMMRBC=2048 DMOST=1 DMCRS=8 RSCEM- 266MHz- 533MHz-


附錄:
附錄1:為了能使用這個命令所有功能,你需要有Linux2.1.82 或以上版本,支援 /proc/bus/pci 介面的核心。在舊版本核心中,PCI工具必須使用只有root才能執行的直接硬體訪問,而且總是出現競爭狀況以及其他問題。
如果你要報告 PCI 裝置驅動中,或者是lspci自身的 bugs,請在報告中包含 “lspci-vvx” 的輸出。

附錄2:CentOS bash:lspci: command not found解決方案
大多使用/sbin/lspci即可,我發現我的系統中/sbin下也沒有。使用yum installlspci顯示沒有這個包。

# yum whatprovides */lspciLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.grandcloud.cn * extras: mirrors.163.com * updates: mirrors.grandcloud.cnbase/filelists                                                                                                                                  | 3.6 MB     00:16extras/filelists_db                                                                                                                             | 241 kB     00:00updates/filelists_db                                                                                                                            | 2.4 MB     00:19pciutils-3.1.7-5.el5.x86_64 : PCI bus related utilities  //這裡顯示的pciutils-3.1.7-5.el5.x86_64Repo        : baseMatched from:Filename    : /sbin/lspcipciutils-3.1.7-3.el5.x86_64 : PCI bus related utilities.Repo        : installedMatched from:Filename    : /sbin/lspci

因此只需要yum install pciutils即可

附錄3.lspci用到的檔案
/usr/share/hwdata/pci.ids:所有已知 PCI ID 的清單 (廠商,裝置名稱,類,子類)
/proc/bus/pci:linux 2.1.82 之後版本核心提供的 PCI 匯流排配置空間的介面。包含每個匯流排 (per-bus) 的子目錄以及每個裝置卡 (per-card) 的配置空間檔案,還有一個 devices 檔案,包含所有PCI裝置的列表

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.