SlideShare a Scribd company logo
1
Peripheral Component
Interconnect (PCI)
2
Some background on PCI
• ISA: Industry Standard Architecture (1981)
• PCI: Peripheral Component Interconnect
• An Intel-backed industry initiative (1992-9)
• Main goals:
– Adds more capabilities to host system (SATA,
USB)
– Improve data-xfers to/from peripheral devices
– Eliminate (or reduce) platform dependencies
– Simplify adding/removing peripheral devices
– Lower total consumption of electrical power
3
Features for driver-writers
• Support for “auto-detection” of devices
• Device configuration is “programmable”
• Introduces “PCI Configuration Space”
• A nonvolatile data-structure of device info
• A standard “header” layout: 64 longwords
• Linux provides some interface functions:
#include <linux/pci.h>
4
5
PCI based System
PCI Topology
• Root Complex – Host Contrller
• End point – PCI device
• CPU-addr – CPU physical address
• Pci-addr – PCI bus address
• Switches - Allow more devices to be
connected
• Bridges - PCI/PCIe to Root complex.
Special purpose peripheral, to joining 2
buses. Plugging more than one bus on a
single system is accomplished. 6
7
8
9
10
11
12
PCI Address Space
• PCI identified by a Bus no, Device no and a
Function no.
• PCI Domain : Can host upto 256 buses, each
bush 32 devices, each device, multifunction
boards ( audio device with CD rom drive
accompany) of max 8 funcions.
• Peripheral devices have their own memory
space
• PCI :PCI I/O, PCI Memory (device driver)
PCI Configuration Space ( initialization)
The ‘lspci’ command
• Linux scans PCI Configuration Space
• It builds a list of ‘pci_dev_struct’ objects
• It exports partial info using a ‘/proc’ file
• You can view this info using a command:
$ /sbin/lspci
• Or you can directly view the /proc/pci file:
$ cat /proc/pci
13
• $ lspci | cut -d: -f1-3
• 0000:00:00.0 Host bridge
• 0000:00:00.1 RAM memory
• 0000:00:00.2 RAM memory
• 0000:00:02.0 USB Controller
• 0000:00:04.0 Multimedia audio controller
• 0000:00:06.0 Bridge
• 0000:00:07.0 ISA bridge
• 0000:00:09.0 USB Controller
• 0000:00:09.1 USB Controller
• 0000:00:0c.0 CardBus bridge
• 0000:00:0f.0 IDE interface
• 0000:00:10.0 Ethernet controller
• 0000:00:12.0 Network controller
• Taking the VGA video controller as an example, 0x00a0 means
0000:00:14.0 when split into domain (16 bits), bus (8 bits), device (5
bits) and function (3 bits). 14
15
PCI Configuration Header
• Allow system to identify and control the
device
• Every PCI slot has it’s PCI Configuration
Header in an offset that is related to it’s slot
on the board
• The PCI configuration space consists of 256
bytes for each device function (PCI Express
devices, which have 4 KB of configuration
space for each function), and the layout of
the configuration registers is standardized.
16
PCI Configuration Header
17
PCI Configuration Header
• Vender Identification
• Device Identification
• Status
• Command
• Class Code
– SCSI : 0x0100
• Base Address Register
• Interrupt Pin (PCI device interrupt pin)
• Interrupt Line (route interrupt to proper handler)
18
PCI I/O and PCI Memory
Address
• PCI configuration code turns on using
Command field
• Linux drivers read/write PCI I/O and PCI
memory addresses
1 00 0
Base Address Registers
0 –Memory request 1 – I/o request
00 – 32bit address decoding
10 – 64bit address decoding
1 – Pre-fatchable 0 – non-prefetchable
19
PCI-ISA Bridges
• The PCI specification copes with this by
reserving the lower regions of the PCI I/O
and PCI Memory address spaces for use by
the ISA peripherals in the system and using
a single PCI-ISA bridge to translate any
PCI memory accesses to those regions into
ISA accesses
20
PCI-PCI Bridges
• PCI-PCI bridges only pass a subset of PCI
I/O and PCI memory read and write
requests downstream
• Linux device drivers only access PCI I/O
and PCI Memory space via these windows
21
22
Type 1 PCI Configuration Cycles
• The primary bus interface being the one
nearest the CPU
• Secondary bus interface being the one
furthest away
• Subordinate bus number is the highest
numbered PCI bus downstream of the PCI-
PCI bridge
23
Type 1 PCI Configuration Cycles
• Ignore it if the bus number specified is not
in between the bridge's secondary bus
number and subordinate bus number
(inclusive),
• Convert it to a Type 0 configuration
command if the bus number specified
matches the secondary bus number of the
bridge,
24
Type 1 PCI Configuration Cycles
• Pass it onto the secondary bus interface
unchanged if the bus number specified is
greater than the secondary bus number and
less than or equal to the subordinate bus
number.
25
Linux PCI Initialization
• PCI device driver
– This pseudo-device driver builds a linked list of
data structures describing the topology of the
system
• PCI BIOS
• PCI Fixup
– system specific fixed up code
pci_dev_struct
• Linux extracts info from PCI Config. Space
• Stores the info in linked-lists of structures
• Examples:
– Name of the device’s manufacturer
– Name and release version of the product
– Hardware resources provided by the product
– System resources allocated to the product
(Linux provides “search-and-extract” routines)
26
27
The Linux Kernel PCI Data
Structures
28
The PCI Device Driver
• A function of the operating system called at
system initialization time
• Scan all of the PCI buses in the system
looking for all PCI devices in the system
(including PCI-PCI bridge devices)
• Configuring PCI-PCI Bridges - Assigning
PCI Bus Number
29
Assigning PCI Bus Number (1)
30
Assigning PCI Bus Number (2)
31
Assigning PCI Bus Number (3)
32
Assigning PCI Bus Number (4)
33
PCI Fixup
• For non-Intel based system
– allocates it space in PCI I/O and/or PCI
Memory
– moves on the global PCI I/O and Memory
bases by the appropriate amounts,
– enables the device's use of PCI I/O and PCI
Memory,
34

More Related Content

PDF
Session 8,9 PCI Express
Subhash Iyer
 
PPTX
Slideshare - PCIe
Jin Wu
 
PPT
PCIe and PCIe driver in WEC7 (Windows Embedded compact 7)
gnkeshava
 
PDF
Pci express technology 3.0
Biddika Manjusree
 
PPTX
PCIe
ChiaYang Tsai
 
ODP
PCIe DL_layer_3.0.1 (1)
Rakeshkumar Sachdev
 
PDF
Message Signaled Interrupts
Anshuman Biswal
 
PDF
Pcie basic
Saifuddin Kaijar
 
Session 8,9 PCI Express
Subhash Iyer
 
Slideshare - PCIe
Jin Wu
 
PCIe and PCIe driver in WEC7 (Windows Embedded compact 7)
gnkeshava
 
Pci express technology 3.0
Biddika Manjusree
 
PCIe DL_layer_3.0.1 (1)
Rakeshkumar Sachdev
 
Message Signaled Interrupts
Anshuman Biswal
 
Pcie basic
Saifuddin Kaijar
 

What's hot (20)

PDF
PCI Drivers
Anil Kumar Pugalia
 
PPTX
PCI express
sarangaprabod
 
PDF
Pci express modi
proma_goswami
 
ODP
Pc ie tl_layer (3)
Rakeshkumar Sachdev
 
PDF
Spi drivers
pradeep_tewani
 
PDF
Network Drivers
Anil Kumar Pugalia
 
PPTX
PCIe Gen 3.0 Presentation @ 4th FPGA Camp
FPGA Central
 
PDF
Arm device tree and linux device drivers
Houcheng Lin
 
PPTX
Difference between PCI PCI-X PCIe
SUNODH GARLAPATI
 
PDF
DPDK: Multi Architecture High Performance Packet Processing
Michelle Holley
 
PDF
Verification Strategy for PCI-Express
DVClub
 
PPTX
Linux I2C
KaidenYu
 
PPTX
AMBA 5 COHERENT HUB INTERFACE.pptx
Sairam Chebrolu
 
PDF
Embedded linux network device driver development
Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation)
 
PDF
Hands-on ethernet driver
SUSE Labs Taipei
 
PDF
PCI Express Verification using Reference Modeling
DVClub
 
PDF
Tutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi Subsystem
Dheryta Jaisinghani
 
PPTX
SPI introduction(Serial Peripheral Interface)
SUNODH GARLAPATI
 
PPTX
Linux PCI device driver
艾鍗科技
 
PDF
Creating Your Own PCI Express System Using FPGAs: Embedded World 2010
Altera Corporation
 
PCI Drivers
Anil Kumar Pugalia
 
PCI express
sarangaprabod
 
Pci express modi
proma_goswami
 
Pc ie tl_layer (3)
Rakeshkumar Sachdev
 
Spi drivers
pradeep_tewani
 
Network Drivers
Anil Kumar Pugalia
 
PCIe Gen 3.0 Presentation @ 4th FPGA Camp
FPGA Central
 
Arm device tree and linux device drivers
Houcheng Lin
 
Difference between PCI PCI-X PCIe
SUNODH GARLAPATI
 
DPDK: Multi Architecture High Performance Packet Processing
Michelle Holley
 
Verification Strategy for PCI-Express
DVClub
 
Linux I2C
KaidenYu
 
AMBA 5 COHERENT HUB INTERFACE.pptx
Sairam Chebrolu
 
Embedded linux network device driver development
Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation)
 
Hands-on ethernet driver
SUSE Labs Taipei
 
PCI Express Verification using Reference Modeling
DVClub
 
Tutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi Subsystem
Dheryta Jaisinghani
 
SPI introduction(Serial Peripheral Interface)
SUNODH GARLAPATI
 
Linux PCI device driver
艾鍗科技
 
Creating Your Own PCI Express System Using FPGAs: Embedded World 2010
Altera Corporation
 
Ad

Similar to Pcie drivers basics (20)

PPTX
PCI bus
mobasith7
 
PPTX
PCI BUS
mobasith7
 
PPT
PCI
ITz_1
 
PDF
PCI.pdf
ssuserea4759
 
DOCX
Peripheral Component Interconnect.docx
Sitamarhi Institute of Technology
 
PPTX
Bus Interfacing with Intel Microprocessors Based Systems
Murtadha Alsabbagh
 
PDF
Bus Standards and Networking
Prabu U
 
ODP
Io Architecture
Aero Plane
 
PDF
PCI_Express_Basics_Background.pdf
zahixdd
 
PDF
PCIe BUS: A State-of-the-Art-Review
IOSRJVSP
 
PPT
P C I L O C A L B U S
jainfu2
 
PPTX
Bus interface 8086
University of Gujrat, Pakistan
 
PPTX
Ec305.13 buses mgl
Д. Ганаа
 
PPTX
Ec305.13 buses mgl
Д. Ганаа
 
PPT
this is PCI & SCSI for computer organisaton and
diksha288711
 
PPTX
Bus & Interface
ImranulHasan6
 
PPTX
BUS PROTOCOL AND AMBA _TRANSACTIONS.pptx
nwkgagycrevxcwdxhd
 
PPTX
Pci,usb,scsi bus
Sherwin Rodrigues
 
PPT
Linux fundamentals Training
Love Steven
 
PPT
XIO2200A PCI Express to 1394a Chip
Premier Farnell
 
PCI bus
mobasith7
 
PCI BUS
mobasith7
 
PCI
ITz_1
 
PCI.pdf
ssuserea4759
 
Peripheral Component Interconnect.docx
Sitamarhi Institute of Technology
 
Bus Interfacing with Intel Microprocessors Based Systems
Murtadha Alsabbagh
 
Bus Standards and Networking
Prabu U
 
Io Architecture
Aero Plane
 
PCI_Express_Basics_Background.pdf
zahixdd
 
PCIe BUS: A State-of-the-Art-Review
IOSRJVSP
 
P C I L O C A L B U S
jainfu2
 
Bus interface 8086
University of Gujrat, Pakistan
 
Ec305.13 buses mgl
Д. Ганаа
 
Ec305.13 buses mgl
Д. Ганаа
 
this is PCI & SCSI for computer organisaton and
diksha288711
 
Bus & Interface
ImranulHasan6
 
BUS PROTOCOL AND AMBA _TRANSACTIONS.pptx
nwkgagycrevxcwdxhd
 
Pci,usb,scsi bus
Sherwin Rodrigues
 
Linux fundamentals Training
Love Steven
 
XIO2200A PCI Express to 1394a Chip
Premier Farnell
 
Ad

Recently uploaded (20)

PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 

Pcie drivers basics

  • 2. 2
  • 3. Some background on PCI • ISA: Industry Standard Architecture (1981) • PCI: Peripheral Component Interconnect • An Intel-backed industry initiative (1992-9) • Main goals: – Adds more capabilities to host system (SATA, USB) – Improve data-xfers to/from peripheral devices – Eliminate (or reduce) platform dependencies – Simplify adding/removing peripheral devices – Lower total consumption of electrical power 3
  • 4. Features for driver-writers • Support for “auto-detection” of devices • Device configuration is “programmable” • Introduces “PCI Configuration Space” • A nonvolatile data-structure of device info • A standard “header” layout: 64 longwords • Linux provides some interface functions: #include <linux/pci.h> 4
  • 6. PCI Topology • Root Complex – Host Contrller • End point – PCI device • CPU-addr – CPU physical address • Pci-addr – PCI bus address • Switches - Allow more devices to be connected • Bridges - PCI/PCIe to Root complex. Special purpose peripheral, to joining 2 buses. Plugging more than one bus on a single system is accomplished. 6
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 11. 11
  • 12. 12 PCI Address Space • PCI identified by a Bus no, Device no and a Function no. • PCI Domain : Can host upto 256 buses, each bush 32 devices, each device, multifunction boards ( audio device with CD rom drive accompany) of max 8 funcions. • Peripheral devices have their own memory space • PCI :PCI I/O, PCI Memory (device driver) PCI Configuration Space ( initialization)
  • 13. The ‘lspci’ command • Linux scans PCI Configuration Space • It builds a list of ‘pci_dev_struct’ objects • It exports partial info using a ‘/proc’ file • You can view this info using a command: $ /sbin/lspci • Or you can directly view the /proc/pci file: $ cat /proc/pci 13
  • 14. • $ lspci | cut -d: -f1-3 • 0000:00:00.0 Host bridge • 0000:00:00.1 RAM memory • 0000:00:00.2 RAM memory • 0000:00:02.0 USB Controller • 0000:00:04.0 Multimedia audio controller • 0000:00:06.0 Bridge • 0000:00:07.0 ISA bridge • 0000:00:09.0 USB Controller • 0000:00:09.1 USB Controller • 0000:00:0c.0 CardBus bridge • 0000:00:0f.0 IDE interface • 0000:00:10.0 Ethernet controller • 0000:00:12.0 Network controller • Taking the VGA video controller as an example, 0x00a0 means 0000:00:14.0 when split into domain (16 bits), bus (8 bits), device (5 bits) and function (3 bits). 14
  • 15. 15 PCI Configuration Header • Allow system to identify and control the device • Every PCI slot has it’s PCI Configuration Header in an offset that is related to it’s slot on the board • The PCI configuration space consists of 256 bytes for each device function (PCI Express devices, which have 4 KB of configuration space for each function), and the layout of the configuration registers is standardized.
  • 17. 17 PCI Configuration Header • Vender Identification • Device Identification • Status • Command • Class Code – SCSI : 0x0100 • Base Address Register • Interrupt Pin (PCI device interrupt pin) • Interrupt Line (route interrupt to proper handler)
  • 18. 18 PCI I/O and PCI Memory Address • PCI configuration code turns on using Command field • Linux drivers read/write PCI I/O and PCI memory addresses 1 00 0 Base Address Registers 0 –Memory request 1 – I/o request 00 – 32bit address decoding 10 – 64bit address decoding 1 – Pre-fatchable 0 – non-prefetchable
  • 19. 19 PCI-ISA Bridges • The PCI specification copes with this by reserving the lower regions of the PCI I/O and PCI Memory address spaces for use by the ISA peripherals in the system and using a single PCI-ISA bridge to translate any PCI memory accesses to those regions into ISA accesses
  • 20. 20 PCI-PCI Bridges • PCI-PCI bridges only pass a subset of PCI I/O and PCI memory read and write requests downstream • Linux device drivers only access PCI I/O and PCI Memory space via these windows
  • 21. 21
  • 22. 22 Type 1 PCI Configuration Cycles • The primary bus interface being the one nearest the CPU • Secondary bus interface being the one furthest away • Subordinate bus number is the highest numbered PCI bus downstream of the PCI- PCI bridge
  • 23. 23 Type 1 PCI Configuration Cycles • Ignore it if the bus number specified is not in between the bridge's secondary bus number and subordinate bus number (inclusive), • Convert it to a Type 0 configuration command if the bus number specified matches the secondary bus number of the bridge,
  • 24. 24 Type 1 PCI Configuration Cycles • Pass it onto the secondary bus interface unchanged if the bus number specified is greater than the secondary bus number and less than or equal to the subordinate bus number.
  • 25. 25 Linux PCI Initialization • PCI device driver – This pseudo-device driver builds a linked list of data structures describing the topology of the system • PCI BIOS • PCI Fixup – system specific fixed up code
  • 26. pci_dev_struct • Linux extracts info from PCI Config. Space • Stores the info in linked-lists of structures • Examples: – Name of the device’s manufacturer – Name and release version of the product – Hardware resources provided by the product – System resources allocated to the product (Linux provides “search-and-extract” routines) 26
  • 27. 27 The Linux Kernel PCI Data Structures
  • 28. 28 The PCI Device Driver • A function of the operating system called at system initialization time • Scan all of the PCI buses in the system looking for all PCI devices in the system (including PCI-PCI bridge devices) • Configuring PCI-PCI Bridges - Assigning PCI Bus Number
  • 29. 29 Assigning PCI Bus Number (1)
  • 30. 30 Assigning PCI Bus Number (2)
  • 31. 31 Assigning PCI Bus Number (3)
  • 32. 32 Assigning PCI Bus Number (4)
  • 33. 33 PCI Fixup • For non-Intel based system – allocates it space in PCI I/O and/or PCI Memory – moves on the global PCI I/O and Memory bases by the appropriate amounts, – enables the device's use of PCI I/O and PCI Memory,
  • 34. 34