PCI Devices in Linux
Tags: linux, pci, ubuntu, bash
Published: 2021-07-31 18:11:07

## What are PCI Devices ? 
A PCI device is any piece of computer hardware that plugs directly into a PCI slot on a computer's motherboard. PCI, which stands for Peripheral Component Interconnect, was introduced to personal computers by the Intel Corporation in 1993. The technology to operate PCI is integrated into the motherboard of nearly every personal computer manufactured since 1995. A PCI connection on a motherboard can be identified as a long strip of raised copper connectors encased in plastic. This long strip of connectors is usually called a bus.

The PCI bus is not as fast as the system bus. Its primary purpose is to facilitate communication of hardware devices of all types such as audio, video, network or graphics with the microprocessor.

### Command to list down all PCI devices in linux system.

The `lspci` command is used to display detailed information about all PCI buses and devices in the server or desktop or laptop powered by Linux operating system.
![lspci](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/20r1irc930neerpzaybe.PNG
)
`lspci –tv` command will list down all the PCI as tree structure because of `–t` and due to `-v` shows the device vendors and names.
![tree pci](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pp08jkt5o3ouyy5f2c31.PNG)
`lspci -k` shows the kernel driver that is being used to handle the respective PCI device
![kernel pci](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bcrtc6654m72n87r1q5r.PNG)
`lspci -m` is used If you want to pass the output of the lspci command to a shell script, you may want to use `-m` option (or `-mm` option) as shown below.
This option is also helpful when you want to view the subsystem information.
![-m](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mja1qwajdnlpbhh9fys2.PNG)
`lspci -n` If you want to display the PCI vendor code, and the device code only as the numbers, use `-n` option. This will not lookup the PCI file to get the corresponding values for the numbers.
![-n](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwmlh2igtarli8q1czs4.PNG)
> **Note**: If you are not able to apply the switches(`lspci [<switches>]`) install pciutils.
```
apt install pciutils
```
Here In the system I have 10 PCI powered by the Linux operating system. 
![lspci](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/20r1irc930neerpzaybe.PNG
)
1.	**Host Bridge** - The "Host Bridge" is what connects the tree of PCI busses (which are
internally connected with PCI-to-PCI Bridges) to the rest of the
system. 
![host bridge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7s5j3zh7234v79nh4s7h.gif)
2. **ISA Bridge** – ISA Stands for Industry Standard Architecture. PCI to ISA bridge is the most common method of interfacing ISA devices to modern chipsets. In most respects, these devices perform like a standard PCI device.
3. **IDE interface** - Integrated Drive Electronics is for connection of storages devices such as Hard Disk Drives (HDD), Solid State Drives (SSD) and CD/DVD drives to the computer.
4. **VGA compatible controller** - VGA stands for Video Graphics Array. VGA Controller is the digital circuit designed to drive VGA displays.
5. **Ethernet controller** - Ethernet controller allows you to make a wired connection to a computer network. This provides access to the network programs and resources, including a high-speed Internet connection.
6. **System peripheral** - It is any external device that provides input and output for the computer. For example, a keyboard and mouse
7. **Multimedia audio controller** - Multimedia audio controller drivers allow your operating system to communicate with the sound hardware such as your speakers, headphones, etc. Thus, if there is a problem with these drivers, your connected audio devices won't work properly.
8. **USB controller** - USB controller is an interface that allows an enabled piece of hardware to interact and communicate with a particular piece of software.
9. **Bridge** - Bridge is a device that connects a PCI bus to either another PCI bus or a bus of a different standard
10. **SATA controller** - SATA controller is a hardware interface that connects a hard drive to a computer's motherboard and manages or directs the flow of data