Prepoznavanje sklopovlja: naredba lspci

U ciklusu članaka o tome kako iskoristiti Linux da bi saznali više o sklopovlju računala, objasnit ćemo korištenje naredbe lspci. Iz naziva je jasno o čemu se radi: izlistavanju podataka o PCI sabirnici i uređajima koji preko nje komuniciraju, poput, na primjer, grafičke ili mrežne kartice.

PCI je kratica za Peripheral Component Interconnect, sabirnicu koju je zamislio Intel još 1992, kako bi zamijenila dotadašnju, sporiju, ISA sabirnicu, najprije u serverima, a potom i u stolnim računalima. PCI je doživjela dva poboljšanja. Najprije su IBM, HP i Compaq objavili PCI-X (eXtended) specifikaciju, a 2004. se pojavila PCI Express (PCIe) sabirnica, koja zadovoljava apetite brzih 64-bitnih procesora.

Podatke o PCI uređajima mogli bismo isčitati iz direktorija /proc/bus/pci, u kojem se nalazi datoteka devices. No tamo su podaci čitljivi strojevima:

cat /proc/bus/pci/devices
0000    80860044    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    agpgart-intel
0010    80860046    2e            d0000004                   0            c000000c                   0                5051                   0                   2              400000                   0            10000000                   0                   8                   0                   0    i915
00b0    80863b64    2b            d4724004                   0                   0                   0                   0                   0                   0                  10                   0                   0                   0                   0                   0                   0    mei
00c8    808610ea    2f            d4700000            d472a000                5021                   0                   0                   0                   0               20000                1000                  20                   0                   0                   0                   0    e1000e
00d0    80863b3c    10            d4729000                   0                   0                   0                   0                   0                   0                 400                   0                   0                   0                   0                   0                   0    ehci-pci
00d8    80863b56    2d            d4720004                   0                   0                   0                   0                   0                   0                4000                   0                   0                   0                   0                   0                   0    snd_hda_intel
00e0    80863b42    28                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    pcieport
00e1    80863b44    29                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    pcieport
00e3    80863b48    2a                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    pcieport
00e8    80863b34    14            d4728000                   0                   0                   0                   0                   0                   0                 400                   0                   0                   0                   0                   0                   0    ehci-pci
00f0    80862448    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    
00f8    80863b07    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    lpc_ich
00fa    80863b2f    2c                5049                505d                5041                5059                5001            d4727000                   0                   8                   4                   8                   4                  20                 800                   0    ahci
00fe    80863b32    12            d4726004                   0                   0                   0                   0                   0                   0                1000                   0                   0                   0                   0                   0                   0    intel ips
4300    14e44315    13            d0500004                   0                   0                   0                   0                   0                   0                4000                   0                   0                   0                   0                   0                   0    wl
4430    11800832    14            d0401000                   0                   0                   0                   0                   0                   0                 800                   0                   0                   0                   0                   0                   0    firewire_ohci
4431    11800822    16            d0403000                   0                   0                   0                   0                   0                   0                 100                   0                   0                   0                   0                   0                   0    sdhci-pci
4432    11800476    16            d0400000                   0                   0                   0                   0                   0                   0                1000                   0                   0                   0                   0                   0                   0    yenta_cardbus
ff00    80862c62    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    
ff01    80862d01    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    
ff10    80862d10    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    
ff11    80862d11    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    
ff12    80862d12    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    
ff13    80862d13    0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0                   0    

Za nas obične smrtnike, koji se ne bavimo pisanjem device drivera, tu je naredba lspci. U osnovnom obliku naredba će izlistati kratak popis sklopovlja koje komunicira PCI sučeljem.

$ lspci 
00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 05)
00:1a.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 05)
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 05)
00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 05)
00:1c.3 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4 (rev 05)
00:1d.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller (rev 05)
00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 05)
43:00.0 Network controller: Broadcom Corporation BCM4312 802.11b/g LP-PHY (rev 01)
44:06.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 06)
44:06.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 25)
44:06.2 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev bb)
ff:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
ff:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
ff:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
ff:02.1 Host bridge: Intel Corporation Core Processor QPI Physical 0 (rev 02)
ff:02.2 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
ff:02.3 Host bridge: Intel Corporation Core Processor Reserved (rev 02)

Tako možemo otkriti na primjer mrežne uređaje: ethernet je Intelov gigabitni 82577LM, a za bežičnu mrežu brine Broadcom BCM 4312.

Uz dodatne parametre naredba će nam dati mnogo više podataka. Na primjer, ako nas zanimaju kernel moduli koji daju softversku podršku izlistanim uređajima, dodat ćemo parametar -k:

$ lspci -k
00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)
    Subsystem: Hewlett-Packard Company Device 7007
    Kernel driver in use: agpgart-intel
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
    Subsystem: Hewlett-Packard Company Device 7007
    Kernel driver in use: i915
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
    Subsystem: Hewlett-Packard Company Device 7007
    Kernel driver in use: mei
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 05)
    Subsystem: Hewlett-Packard Company Device 7007
    Kernel driver in use: e1000e
00:1a.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)
    Subsystem: Hewlett-Packard Company Device 7007
    Kernel driver in use: ehci-pci
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 05)
    Subsystem: Hewlett-Packard Company Device 7007
    Kernel driver in use: snd_hda_intel
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 05)
    Kernel driver in use: pcieport
00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 05)
    Kernel driver in use: pcieport
...

Mnogo više podataka dobit ćemo ako zatražimo opširniji izvještaj, za što se na Unixima tradicionalno koristi -v (verbose). Ako nam to nije dosta, radi i -vv i -vvv.

$ lspci -kv
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 05)
    Subsystem: Hewlett-Packard Company Device 7007
    Flags: bus master, fast devsel, latency 0, IRQ 45
    Memory at d4700000 (32-bit, non-prefetchable) [size=128K]
    Memory at d472a000 (32-bit, non-prefetchable) [size=4K]
    I/O ports at 5020 [size=32]
    Capabilities: <access denied>
    Kernel driver in use: e1000e

Pokazali smo samo podatke za ethernet kontroler. Obratite pažnju na predzadnji redak: neke podatke možemo dobiti samo s root ovlastima:

$ sudo lspci -kv
...
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 05)
    Subsystem: Hewlett-Packard Company Device 7007
    Flags: bus master, fast devsel, latency 0, IRQ 45
    Memory at d4700000 (32-bit, non-prefetchable) [size=128K]
    Memory at d472a000 (32-bit, non-prefetchable) [size=4K]
    I/O ports at 5020 [size=32]
    Capabilities: [c8] Power Management version 2
    Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
    Capabilities: [e0] PCI Advanced Features
    Kernel driver in use: e1000e
...

Stupanj rječitosti možemo povećati ponavljanjem prekidača -v:

$ sudo lspci -kvvv
...
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 05)
    Subsystem: Hewlett-Packard Company Device 7007
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0
    Interrupt: pin A routed to IRQ 45
    Region 0: Memory at d4700000 (32-bit, non-prefetchable) [size=128K]
    Region 1: Memory at d472a000 (32-bit, non-prefetchable) [size=4K]
    Region 2: I/O ports at 5020 [size=32]
    Capabilities: [c8] Power Management version 2
        Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
        Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME-
    Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Address: 00000000fee0f00c  Data: 4173
    Capabilities: [e0] PCI Advanced Features
        AFCap: TP+ FLR+
        AFCtrl: FLR-
        AFStatus: TP-
    Kernel driver in use: e1000e

Što ako želite ispis podataka o samo jednom uređaju? Za to postoji parametar -d (device), ali iza njega ne možete napisati ime uređaja, na primjer ethernet, nego se traži ID proizvođača, dvotočka, pa ID uređaja. U /proc/bus/pci/devices ID-jevi su sadržani u drugom polju, ali bez dvotočke. U našem primjeru, redak iz devices za ethernet izgleda ovako:

00c8    808610ea    2d            d4700000            d472a000                5021                   0                   0                   0                   0               20000                1000                  20                   0                   0                   0                   0    e1000e

Prepoznajemo ga po kernel driveru e1000e. Šifre identiteta proizvođača i uređaja sadržane su u drugom polju (808610ea), preostaje u sredinu umetnuti dvotočku:

$ sudo lspci -kvvv -d 8086:10ea

Možda je lakši put pronalaženje ID-jeva korištenje parametra -n, pa se umjesto naziva proizvođača ispišu šifre identiteta. Evo primjera za ethernet sučelje:

$ lspci
...
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 05)
$ lspci -n
...
00:19.0 0200: 8086:10ea (rev 05)

Time smo otkrili osnove korištenja naredbe lspci, koja nam pomaže pri prepoznavanju sklopovlja.

Vezani članci:

Prepoznavanje sklopovlja računala

Prepoznavanje sklopovlja: podaci iz BIOS-a

Kuharice: 
Kategorije: 
Vote: 
0
No votes yet